digitalmars.D - DIP4: Properties
- Nick Sabalausky (5/5) Jul 24 2009 (Is this post going to show up this time? Hopefully third time's a charm...
(Is this post going to show up this time? Hopefully third time's a charm...) An alternate usage/definition syntax for properties. http://prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP4 Note that there are a few parts marked NEED HELP, that could use assistance from someone with more expertise in this than me.
Jul 24 2009
Nick Sabalausky Wrote:An alternate usage/definition syntax for properties. http://prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP4 Note that there are a few parts marked NEED HELP, that could use assistance from someone with more expertise in this than me.I'm not sure about combining a property with its backing store - unless the shorthand version is being used, in which case it seems OK. And if the concern is about magic values and new keywords, this version needs neither: class Book { // explicitly declared backing store for author property. private string author_; string author { string() { return author_; } void(string value) { author_ = value; } } // Shorthand property, backing store is generated by compiler. string title { string(); void(string); } } Slightly more verbose, but it's not hideous and doesn't feel alien. John.
Jul 25 2009
Nick Sabalausky Wrote:An alternate usage/definition syntax for properties. http://prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP4Overriding semantic should be outlined too.
Jul 28 2009