DIP 1030--Named Arguments--Community Review Round 1 Discussion

FeepingCreature feepingcreature at gmail.com
Sat Feb 8 09:02:40 UTC 2020


On Saturday, 8 February 2020 at 08:42:57 UTC, Paolo Invernizzi 
wrote:
> I think Jonathan have nailed the point:. In my little, I've a 
> PR waiting for months as it breaks a possible derived class of 
> Phobos Socket, as none is marking methods 'final' when it's not 
> intended to be part of the API. And that remember me that, once 
> alone a time, you and Andrei agreed that turning the default to 
> 'final' from 'virtual' was the correct thing to do, 
> specifically for the above point: the default should encourage 
> the writing of a "minimalist" API boundary.


I'm sorry, I need to hammer this in.

A nameless API is not minimal. An API is not made more minimal by 
ignoring the names! The *meaning* of parameters is part of the 
API! If you have a function DateTime(1, 2, 3), then you already 
have a function DateTime that takes day, month and year, whether 
or not you have named parameters! The only difference is that the 
*meanings* "day", "month" and "year", which are part of the API 
in either case(!), are attached to the *positions* of the 
parameters. So now the *positions* of parameters are an 
irreducible part of the public API.

And frankly to me that's a lot worse than having the names being 
part of it. Names you can at least remember sometimes. Positions 
are fully arbitrary. Named parameters are just the API being 
honest about the meaning it *already* carries in its 
specification, instead of hiding it behind meaningless numbers.


More information about the Digitalmars-d mailing list