new DIP5: Properties 2

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Aug 1 21:23:31 PDT 2009


Benji Smith wrote:
> Andrei Alexandrescu wrote:
> 
>> Thanks for these great points. As an additional example, most ranges 
>> define the method
>>
>> bool empty() { ... }
>>
>> whereas infinite ranges define the enum
>>
>> enum bool empty = false;
>>
>> It follows that if a range user wants to be compatible with finite and 
>> infinite ranges, they always must use no "()". It would be nice if the 
>> range's definition could enforce that.
>>
>>
>> Andrei
> 
> Huh. How does this reconcile with your previous posts, where you said 
> it'd probably be a bad idea for the API designer to mandate the function 
> calling style of the API consumer?
> 
> Is this the same issue, and you've changed your mind? Or do you see this 
> as a different issue?

I found the way he put it - avoiding gratuitous inconsistency between 
fields and properties - a compelling perspective.

Andrei



More information about the Digitalmars-d mailing list