DIP23 draft: Fixing properties redux

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Feb 3 09:39:04 PST 2013


On 2/3/13 7:59 AM, Timon Gehr wrote:
> On 02/03/2013 09:16 AM, Andrei Alexandrescu wrote:
>> Walter and I have had a discussion on how to finalize properties.
>>
>> http://wiki.dlang.org/DIP23
>> ...
>
> Looks good. Two things:
>
> What about eg:
>
> @property T front(T)(T[] arr){ return arr[0]; }

I updated the doc to clarify that one-parameter properties are ALWAYS 
getters and two-parameter properties are ALWAYS setters.

> And:
>
> "Avoid embarrassing situations such as expressions with unexpressible
> types or no-op address-of operator (as is the case with C functions)."
>
> The DIP does not fix the first issue.
>
> pragma(msg, typeof(*(int x)=>x)); // pure nothrow @safe int(int x)

I see. I think dereferencing a function or delegate type should never work.

Andrei


More information about the Digitalmars-d mailing list