foo => "bar" key/value literals in D!

Vladimir Panteleev via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sat Jun 11 08:46:59 PDT 2016


On Saturday, 11 June 2016 at 11:15:43 UTC, ArturG wrote:
> 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);

Taking an address creates a function pointer, which loses the 
argument names. (Doesn't it?)



More information about the Digitalmars-d-announce mailing list