Re: Properties
- From: Arne Vajhøj <arne@xxxxxxxxxx>
- Date: Mon, 09 Oct 2006 19:55:06 -0400
Jon Slaughter wrote:
If, suppose, you can explain why the follow will not work then I might understand some of you.
I will "extend" the C# grammar by creating a parser. The parser inputs a super set of the grammar of C# and returns compatible C# code.
Heres how the simplified parser works(would actually do more if implemented):
1. Looks for any properties.
2. Get the name of the property.
3. Creates a private field in the same class as the property and appends a random string to the the name of property and use that for the field.
4. looks for any references to properties and the use the .this quantifier. If found replaces these tokens with the name of the field generated in 3.
5. repeat until done.
Example.
Extended C#:
public string Name
{
get { return Name.this }
set { Name.this = value; }
}
after parse, changed text in brackets:
private string Name398492893;
public string Name
{
get { return Name398492893 }
set { Name398492893 = value; }
}
Is there any reason why this would not work and not simplify the redudancy in creating properties?
Nothin is preventing you from creating the new language
jon# with all the features you want.
But I would not switch to that language, because
I can not see any advantage of it.
And the preprocessor model has some disadvantages in
the build and debug process when it is not supported
by the compiler.
Arne
.
- References:
- Properties
- From: Jon Slaughter
- Re: Properties
- From: Jon Slaughter
- Properties
- Prev by Date: Re: Properties
- Next by Date: Re: How to close a web page?
- Previous by thread: Re: Properties
- Next by thread: Re: Properties
- Index(es):
Relevant Pages
|