On 2012-06-17 08:39, Tommi wrote:
As I see it, the goal of uniform function call syntax, as described here
http://www.drdobbs.com/blogs/cpp/232700394, is to allow non-intrusively
extending the functionality of a type. I think the current
implementation comes short in accomplishing this goal on two accounts:
1) You can't non-intrusively add static member functions
2) You can't non-intrusively add constructors
So, I'm suggesting these two features to be added to the language:
1. Static method lowering rules
If function calls like the following are encountered...
A) Type.compute(<ARGUMENTS>);
B) Type.compute; // it's a static @property function
...and the compute functions haven't been implemented by Type,
they get lowered into free function calls...
A) compute!(Type)(<ARGUMENTS>);
B) compute!(Type);
2. Constructors as free functions
If a constructor call hasn't been implemented by Type...
auto t = Type(<ARGUMENTS>);
...then it get's lowered into a free function call...
auto t = this!(Type)(<ARGUMENTS>);
(or something like that)
I like that idea.
--
/Jacob Carlborg