DIP23 draft: Fixing properties redux

Timon Gehr timon.gehr at gmx.ch
Sun Feb 3 15:04:43 PST 2013


On 02/03/2013 09:16 AM, Andrei Alexandrescu wrote:
> ...
>
> * Just mentioning a function or method without parens does NOT
> automatically take its address. (This is a change from the current
> behavior.)
>

(No, it is not.)

 From the DIP:

"This proposal sustains that optional parentheses should stay in. That 
means, if a function or method may be called without arguments, the 
trailing parens may be omitted. [...] The same goes about methods: [...] 
However, that's not the case with function objects, delegate objects, or 
objects that implement the function call operator. [...]"

Should also mention static opCall.

The section does not mention what happens with first class callables 
that are invoked via UFCS. In particular, the validity of eg. the 
following code (which currently is valid) is not specified:

enum foo = (int x)=>x;
static assert(2==2.foo);



More information about the Digitalmars-d mailing list