DIP4: Properties

Daniel Keep daniel.keep.lists at gmail.com
Sun Jul 26 08:09:59 PDT 2009



Leandro Lucarella wrote:
> Nick Sabalausky, el 24 de julio a las 00:39 me escribiste:
>>  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.
> 
> After reading all the threads again, I think the best proposal is the
> opGet_foo() / opSet_foo() for diferentiating functions and properties.
> I think is the more D-ish solution.
> 
> I don't like the "_name" though, because it adds semantic infomation to
> the identifier, maybe a more template-like syntax can be used:

That would involve changing template syntax to allow for identifiers to
be passed as an argument.

Besides, templates can't be used as virtual methods, so they can't be
overridden and can't appear in interfaces.

> ...
> 
> I used an example without trivial properties because... well, you just use
> member variables for that. That's why I don't see real value in adding
> default properties getter/setters.

interface I
{
    int opGet_value();
}

You cannot use fields in an interface.



More information about the Digitalmars-d mailing list