Make dur a property?
Adam D. Ruppe
destructionator at gmail.com
Wed Jan 23 11:35:07 PST 2013
On Wednesday, 23 January 2013 at 19:18:09 UTC, Johannes Pfau
wrote:
> int DG() {return 42};
> int delegate() getDG() {return &DG};
>
> auto dg = getDG; //OK
> auto ??? = getDG();
>
> The last line could be a call to getDG with optional
> parenthesis,
> so ??? = DG. Or it could be a call to getDG without optional
> parenthesis and a call to the returned DG, so ??? = 42.
If getDG is a @property, ??? == 42, because getDG() is rewritten
into (getDG())() - parens there would ALWAYS mean "call the
return value", so any @property is indistinguishable from its
return value. (if we get @property like I want)
Without @property, it'd return DG because while parenthesis are
optional, if they are present, they always apply to the preceding
thing directly; getDG == getDG() in all cases. (This is the
status quo, which I'd retain)
The type system will help catch errors here better than the
syntax.
More information about the Digitalmars-d
mailing list