Reddit: why aren't people using D?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Jul 27 14:56:00 PDT 2009


Rainer Deyke wrote:
> Nick Sabalausky wrote:
>> I can't be nice about this: Any programmer who has *any* aggrivation 
>> learning any even remotely sane property syntax is an idiot, period. They'd 
>> have to be incompetent to not be able to look at an example like this:
>>
>> // Fine, I'll throw DRY away:
>> int _width;
>> int width
>> {
>>     get { return _width; }
>>     set(v) { _width = v; }
>> }
>>
>> And immediately know exactly how the poroperty syntax works.
> 
> I don't know exactly how this is supposed to work.  The basic idea is
> obvious, but:
>   - How does it interact with inheritance?  Can I override properties?
> Can I partially override properties (setter but not getter)?
>   - Can I write a setter that accepts another type?
>   - Can I write a templated setter that accepts *all* types?  If so, how?
>   - Can I create a delegate from a setter/getter?  If so, how?
>   - I assume that getters/setters can have individual access specifiers
> (i.e. private/protected/public), but is that really the case?
> 
> Dedicated property syntax isn't hard to learn, but it's not as obvious
> as you make it our to be.  Note that none of these issues exist with
> opGet_foo, which follows the same rules as all functions.
> 
> 

+1

Andrei



More information about the Digitalmars-d mailing list