DIP 1020--Named Parameters--Community Review Round 1

David Gileadi gileadisNOSPM at gmail.com
Mon Apr 1 15:56:04 UTC 2019


On 3/31/19 8:53 AM, Andre Pany wrote:
> I still have the opinion we should go for in place struct initialization 
> first. Here we get named parameters implicit without adding a complete 
> new syntax. I also do not like the new syntax <>.
> Leveraging what inplace struct initialization syntax gives us, seems a 
> lot more reasonable in my opinion.
> 
> Kind regards
> Andre

I keep feeling like the in-place struct initialization proposal plus the 
syntax sugar described in its "Bonus 1"[1] would be perfect. It strikes 
me as very D-ish: clever, simple to explain, doesn't conflict with 
existing features, and allows the call-side things we want from named 
parameters like omitting arguments and/or providing them in any order, 
per existing rules for static initialization of structs [2].

[1]: 
https://github.com/dlang/DIPs/blob/b1283b455b635d7dcbc2c871d2aa47cc67190059/DIPs/DIP1xxx-sw.md#bonus-1-function-calls-with-the-struct-argument-as-sole-parameter
[2]: https://dlang.org/spec/struct.html#static_struct_init


More information about the Digitalmars-d mailing list