2013/2/4 Andrei Alexandrescu <[email protected]>

>
> Couldn't AddressOf use "&(" + exp + ")"?
>

Yes. It's enough. I wanted to explain that "we should treat
address-expression carefully".


> I thought more about this. The problem remains even without @property, due
> to optional parens in function invocation. Consider:
>
> ref int fun() { ... }
> auto p1 = &fun;
> auto p2 = &(fun);
> auto p3 = &(fun());
>
> What are the types of the three? The optional parens in invocation require
> some disambiguation. I think the sensible disambiguation is to have &fun
> take the address of fun and the other two take the address of fun's result.
>

Agreed.


> I would agree restricting the properties, but requiring a __trait to take
> the address of a regular function or method seems overkill.


Fully agreed.

Although it looks strange and unstable, adding new distinction of semantics
between &foo and &(foo) has no ambiguity.

I think this is necessary feature for the D's function and property
semantics.

Kenji Hara

Reply via email to