Weird template error

bearophile bearophileHUGS at lycos.com
Thu Nov 27 01:19:33 PST 2008


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

It sounds nice, but then this is what may happen:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/1173059b4c786e4b#

That's why I have suggested a more explicit syntax, to avoid mistakes, that only adds a char (&):
auto x = foo(); // call the callable
auto x = &foo; // delegate or function pointer or closure
auto x = foo.sizeof; // OK, x becomes 4 or 8, etc.
auto x = foo; // syntax error

Bye,
bearophile



More information about the Digitalmars-d mailing list