DIP23 draft: Fixing properties redux
Andrej Mitrovic
andrej.mitrovich at gmail.com
Sun Feb 3 09:58:22 PST 2013
On 2/3/13, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> For properties &a.prop is not the same as &(a.prop),
> which is unlike other expressions.
I have an idea. The DIP says that @property cannot return a @property
function. Therefore we could introduce a new built-in property (pardon
the pun) that only @property functions have, ala:
a.prop.addrOf
Similar to how we have .funcPtr for other types. This field would only
exist for @propery functions and therefore it's never ambiguous on
whether it applies to the function or to the function call (it *has*
to apply to the function since it cannot return a @property.
So instead of having behavior based on whether there are any parens
involved, you would have:
&a.prop; // address of return value
&(a.prop) // ditto
a.prop.addrOf // address of property function
More information about the Digitalmars-d
mailing list