DIP23 draft: Fixing properties redux

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Feb 3 21:33:39 PST 2013


On 2/3/13 11:17 PM, BLM768 wrote:
> On Monday, 4 February 2013 at 04:00:28 UTC, David Nadlinger wrote:
>> On Monday, 4 February 2013 at 03:15:51 UTC, David Nadlinger wrote:
>>
>> And how often do you think you'll find yourself in the situation of
>> needing to get a delegate from a property anyway? Can't we just make
>> »@property getter expressions are always equivalent to their return
>> value« a hard (simple!) rule and add something like
>> __traits(propertyGetter, ...) for the rare cases where you really need
>> to get hold of the underlying function?
>>
>> David
>
> I like this solution; it follows the Principle of Least Surprise
> quite well. The syntax may be a bit longer, but it's immediately
> obvious even to a beginning/intermediate D user what's going on
> without having to worry about too many nuances.

This is a good point, and __traits make all possible syntactic confusion 
go away.

Andrei


More information about the Digitalmars-d mailing list