foo => "bar" key/value literals in D!
ArturG via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Sat Jun 11 04:15:43 PDT 2016
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);
More information about the Digitalmars-d-announce
mailing list