El 18/01/2012 21:37, Nick Sabalausky escribió:
"Nick Sabalausky"<a@a.a> wrote in message Plus I've spent time in other langauges where using a function name without parens is the way to refer to a function itself, rather than invoke the function. That's something I very much like: "foo" refers to the function, "foo()" calls the function. Period. End of story. But in D, while "foo()" calls a function, refering to a function is a mess: usually it's "&foo", but if you're aliasing it or passing it as a template alias parameter than it's "foo". But then if you use "foo" in other places, it calls the function instead of referring to it! Bleh!!! Messy, messy.
Exactly, to my eyes the () is what says "execute!", what triggers the action, so:
f = func; // even if not in D, looks like getting the function itself (a pointer to it)
x = func(); // looks like "execute func" and assign its ret value to x even with void returning functions: doThat(); // the () is like "Action!" In fact, why not get rid of the & to get a reference to a function? So my vote is: properties: always without (), methods: always ()