As discussed in DConf2015: Python-like keyword arguments

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 4 10:53:19 PDT 2015


And if you add this, it gets even more interesting:

void main() {
     alias myFunc = ctKwargify!func.wrap;
     myFunc!(Bar(2), Baz(3), Foo(1));
     myFunc!(Baz(3), Foo(1));
}

template ctKwargify(alias F) {
     template wrap(T...) {
         alias wrap  = ctKwargs!(F, T);
     }
}

template ctKwargifier(alias F) {
     template inner(T...) {
         alias ctKwargifier = ctKwargs!(F, T);
     }
}


I might have gone insane now.


More information about the Digitalmars-d mailing list