On 2009-08-03 10:06:23 -0400, "Robert Jacques" <[email protected]> said:

On Mon, 03 Aug 2009 00:27:45 -0400, Nick Sabalausky <[email protected]> wrote:

"Robert Jacques" <[email protected]> wrote in message
news:[email protected]...

I agree 1) is an issue, but I view it as a corner case. (I use zero/one
arg functions all the time and make use of the 'property' syntax left
right and center, but I've never run into the opCall problem) It would  be
nice if it were fixed, but we may be cutting off the nose to spite the
face, as it were. (Or alternatively, taking the scientific instead of
engineering approach)


It'll become a major PITA when D gets used for heavy functional-style  stuff.

Maybe. But how often will people return zero-argument opCalls (function pointers/delegates/structs) from zero-argument functions? (i.e. how often do you run into this today?)

The compiler isn't as smart as you think. This doesn't compile, it requires an empty pair of parenthesis:

        void delegate(int) func();

        func(1);

And I somewhat doubt it should be smart enough for this, because if you then add a overloaded function "func" that takes an int you're silently chaning the meaning of the code.

Solve this for fun:

        void delegate() func(int);
        void delegate(int) func();

        func(1); // which one?

--
Michel Fortin
[email protected]
http://michelf.com/

Reply via email to