named arguments (C++) - Something D could learn from

rikki cattermole rikki at cattermole.co.nz
Fri Dec 14 21:34:59 UTC 2018


On 15/12/2018 10:22 AM, Dukc wrote:
> On Friday, 14 December 2018 at 20:13:42 UTC, bauss wrote:
>> I still think named arguments should be something to consider 
>> implementing for D, but since everything requires a DIP and it's very 
>> hard to write a DIP that's proper for such a thing then I guess it'll 
>> just be a dream, forever.
> 
> Hope if far from lost here. There is not one, but two DIPs in draft 
> stage to add named function parameters to D:
> 
> https://github.com/dlang/DIPs/pull/123
> https://github.com/dlang/DIPs/pull/126

Disclaimer the second DIP is mine.

The first is mostly concerned with syntax sugar.
The second is about modelling externally setting internal (but private) 
attributes that are visible publicly.

They both have their own pluses and minuses, but IMO the second is much 
harder to implement as a library. In fact we already do, see ElementType 
for input ranges. We can do better at modelling this.


More information about the Digitalmars-d mailing list