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

aliak something at something.com
Tue Apr 9 21:20:03 UTC 2019


On Tuesday, 9 April 2019 at 19:46:47 UTC, Seb wrote:
> On Monday, 1 April 2019 at 11:39:50 UTC, rikki cattermole wrote:
>> As the author of this DIP, I have created a list of actionable 
>> items I expect to include in the next iteration of the DIP.
>>
>> [...]
>
> BTW are you aware of the recently accepted PEP 570 for Python 
> [1]?
>
> It allows library authors optionally to control exactly which 
> parameters are positional and which are keyword-only and which 
> are both.
>
> [1] https://www.python.org/dev/peps/pep-0570/

Can't say I'm a fan of the chosen syntax (also can't say I can 
think of anything better in python's case). But IMO they've got 
the motivation, rationale, and benefits down awesomely well. It's 
finally fixing (in theory) one of my personal sore points with 
python :D

It's worth considering allowing API authors to control how their 
APIs ought to be called. I've never completely understood why 
reordering is a requirement for some from the caller's side. It 
doesn't really add anything in terms of readability or 
maintainability in my experience - in-fact it reduces them 
because consistency goes out the window. And I'm not sure how 
allowing all parameters to be called as named is going to help in 
anyway other than making API authors' lives harder in terms of 
maintenance costs:



More information about the Digitalmars-d mailing list