Property discussion wrap-up

TommiT tommitissari at hotmail.com
Wed Jan 30 10:49:25 PST 2013


On Wednesday, 30 January 2013 at 18:06:47 UTC, Timon Gehr wrote:
> This is subject to 4 exceptions:
>
> auto foo() { ... }
>
> 1. &foo           // get function pointer or delegate
> 2. alias x = foo; // alias to function (same for alias params)
> 3. typeof(foo)    // type of function
> 4. foo()          // function called

I'd count only 1. and 3. as exceptions to the rule. I don't see 
how is 4. is an exception - it's just a regular function call 
without omitting the parens. I'm not sure if it's possible to 
create an alias to an expression like:

alias x = foo;

...but if it's possible, then I think it's fine to allow it. It 
will work as if x were the expression it aliases, and would work 
like:

int value = x; // this is same as writing int value = foo;

...given that foo() returns something that's convertible to int.


More information about the Digitalmars-d mailing list