DIP23 draft: Fixing properties redux
eles
eles at eles.com
Sun Feb 3 14:24:52 PST 2013
On Sunday, 3 February 2013 at 08:16:08 UTC, Andrei Alexandrescu
wrote:
> In brief:
>
> * Optional parens stay.
This syntax sugar only helps in chained-UFCS calling. Why
allowing it everywhere, that is even if the function's name is
not followed by a dot?
like this: Obj1.action1.action2.action3(); It is clearer than
Obj1.action1().action2().action3(); and, still, does not allow
something like Obj1.action1; requiring an Obj1.action1(); instead.
> * Just mentioning a function or method without parens does NOT
> automatically take its address. (This is a change from the
> current behavior.)
If you stick to the above "optional only if followed by a
dot"-paradigm, you could maintain the behavior, except in that
UFCS-chains, where it doesn't matter anyway what mentioning a
function or method without parens returns, since one assumes
invocation in this kind of chains.
> * Read properties (using @property) work as expected with the
> mention that they may NOT be called with the parens. Any parens
> would apply to the returned value.
And if the returned value is a parameterless function, shouldn't
that be callable without parens?
> * Write properties (using @property) may only be used in the
> assignment form (no function-style call allowed).
More information about the Digitalmars-d
mailing list