On Saturday, 11 June 2016 at 09:07:43 UTC, Andrei Alexandrescu wrote:

No, both are nice to have. If one name is needed for both, "args" is indeed a good commonality. "Invoke function f with these args" and "Construct an object of type T with these args". The problem is it's not very intuitive in usage.

Perhaps "call" for functions and "make" for objects are better. If we add these to std.experimental.functional and std.experimental.conv and they get a lot of usage we might make a small change to the language.


Andrei

would'nt it be possible to take the type as a runtime param
and support struct, class and all callables?
e.g.

(&fun).args!(a=>5, b=>6);

auto st = SomeStruct().args!(a=>3);

auto sc = new SomeClass().args!(x => 20, y => 50);

(&sc.fun).args!(x => 6);

or named and positional args
(&sc.fun).args!(x => 9)(3, 6);

Reply via email to