Weird template error

bearophile bearophileHUGS at lycos.com
Tue Nov 25 23:29:04 PST 2008


Nick Sabalausky
> That's why I like the consistency other languages have of:
> - With parens: Invoke function
> - Without parens: Refer to function itself
> Example of preferred syntax:
> ...

I agree, this is better (in Python there's such syntax).
(I am hopeful for the future of D because I've seen there are lot of people in this neswgroup that seem to have better ideas :-) ).

In alternative, you may also require the & to refer to the function, this makes the syntax more explicit and makes the compiler raise an error if you forget both parens or &:
auto x = foo(); // call the callable
auto x = &foo; // delegate or function pointer or closure
auto x = foo; // syntax error

Bye,
bearophile



More information about the Digitalmars-d mailing list