Is there a nice syntax to achieve optional named parameters?

SrMordred patric.dexheimer at gmail.com
Thu Jan 17 16:55:33 UTC 2019


On Thursday, 17 January 2019 at 12:11:02 UTC, Matheus wrote:
>
> foo(alias x){}
>
> foo("a");
> foo(1);
>
> 'x' will be string one time and integer another? Or there is 
> something that I'm missing.
>
> Matheus.

Yes, but there is a mistake there:
alias is part of the template:

foo(alias x)(){} //note extra parens

than u call like an template:

foo!"a"; //equivalent = foo!("a")();
foo!1;


More information about the Digitalmars-d-learn mailing list