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

Meta via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed May 25 11:55:16 PDT 2016


On Wednesday, 25 May 2016 at 11:22:41 UTC, Jacob Carlborg wrote:
> I don't think this is the right approach. I think the correct 
> approach is to allow introspection of template parameters [1]. 
> That would allow to get the parameter names without having to 
> instantiate the template.

Is that true? I don't claim to know exactly how the compiler 
works, but given a template lambda:

foo => 3

Doesn't it generate something like the following?

template __lambda10293(T)
{
     <deduced return type> __lambda10293(T foo)
     {
         return 3;
     }
}

In that case, "foo" is not a template parameter, but a runtime 
parameter, so template parameter introspection would not help in 
this case.




More information about the Digitalmars-d-announce mailing list