DIP23 draft: Fixing properties redux

kenji hara k.hara.pg at gmail.com
Mon Feb 4 06:38:07 PST 2013


2013/2/4 Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org>

>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130204/032f82e3/attachment.html>


More information about the Digitalmars-d mailing list