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

aliak something at something.com
Sun Jun 9 11:26:07 UTC 2019


On Sunday, 9 June 2019 at 11:15:39 UTC, aliak wrote:
> On Sunday, 9 June 2019 at 07:51:18 UTC, Andrei Alexandrescu 
> wrote:
>> On 6/8/19 2:05 PM, Jonathan Marler wrote:
>>> I see value in allowing a caller to omit arguments that have 
>>> default values, but what is the value in allowing the caller 
>>> to reorder them?
>>
>> Named arguments is useful mainly so one doesn't need to 
>> remember their order in large argument lists.
>
> When has anyone had a problem with unreorderable named 
> arguments in functions with large argument lists?
>
> After using languages with unreorderable and reorderable named 
> parameters. I only see a very mild benefit of programmer 
> laziness for reorderable, and the larger downside of reader 
> annoyance. I've felt no downsides of unreorderable (you 
> generally look at the documentation, and type it in param by 
> param, or copy paste the declaration, and if you get it wrong, 
> the compiler tells you and you fix it).

There're also some technical advantages/disadvantages to either 
or:

1) searchability is out the window if you allow reordering
   find "func(a:" will now not work
2) semantic overloading is out the window
   lets(int doA, int thenB int thenC)
   lets(int doA, int thenC, int thenB)

I'm not sure what technical advantages reordering brings though.

I also wonder what kind of overload resolution can be 
accomplished with reorderable and unreorderable, and also what 
kind of overload resolution is blocked with either of the two. I 
believe that should also be taken in to account to make a better 
decision here.

Maybe the DIP can address that point as well?

Cheers
- Ali


More information about the Digitalmars-d mailing list