DIP 1019--Named Arguments Lite--Community Review Round 1

Yuxuan Shui yshuiv7 at gmail.com
Fri Mar 22 15:18:09 UTC 2019


On Thursday, 21 March 2019 at 20:31:57 UTC, David Bennett wrote:
> On Sunday, 17 February 2019 at 21:04:23 UTC, Yuxuan Shui wrote:
>> After thinking about the feedback so far, I currently plan to 
>> make these changes to this DIP:
>>
>> ...
>
> Would you also be able to confirm how this DIP handles default 
> arguments and templates?
> I think the DIP could use an example showing this off.

This DIP won't support template arguments.

And with my current plan this DIP probably won't help default 
arguments either.

>
> One of my almost dally 'is there no better way?' moments with D 
> currently is default template arguments, for example to change 
> throwErrors currently I need to do:
>
> ---
>
> T toString(T=string, bool SomeThing=true, bool 
> throwErrors=true, S)(S value){return "";}
>
> auto foo = 123.toString!(string, true, false);
>
> ---
>
> Where as I think something like this would be better:
>
> ---
>
> auto foo = 123.toString!(throwErrors: false);
>
> ---

Yes, that would be better, but sadly that's out of the scope of 
this DIP.




More information about the Digitalmars-d mailing list