DIP 1030-- Named Arguments--Formal Assessment

Jean-Louis Leroy jl at leroy.nyc
Thu Sep 17 13:23:38 UTC 2020


On Thursday, 17 September 2020 at 12:58:06 UTC, Mike Parker wrote:
> DIP 1030, "Named Arguments", has been accepted.
>
> During the assessment, Walter and Atila had a discussion 
> regarding this particular criticism:
>
> https://forum.dlang.org/post/mailman.1117.1581368593.31109.digitalmars-d@puremagic.com
>
> "Named arguments breaks this very important pattern:
>
> auto wrapper(alias origFun)(Parameters!origFun args)
> {
>   // special sauce
>   return origFun(args);
> }"
>
> They say that, though it's true that `Parameters!func` will not 
> work in a wrapper, it "doesn't really work now"---default 
> arguments and storage classes must be accounted for. This can 
> be done with string mixins, or using a technique referred to by 
> Jean-Louis Leroy as "refraction", both of which are clumsy.

Actually, Parameters!origFun will carry storage classes, UDAs, 
etc for all the parameters. And Parameters!origFun[0..1] (note 
the two dots) will carry everything about the first parameter. 
The trouble begins when, for some reason, you need to manipulate 
the parameter at a finer level. For example, in openmethods, I 
need to change the type while preserving everything else.


More information about the Digitalmars-d-announce mailing list