DIP 1019--Named Arguments Lite--Final Review

Andrei Alexandrescu SeeWebsiteForEmail at erdani.com
Fri Aug 23 17:49:17 UTC 2019


On 8/23/19 12:19 PM, Dennis wrote:
> On Friday, 23 August 2019 at 15:01:20 UTC, Andrei Alexandrescu wrote:
>> Large parameter lists of which most have reasonable defaults is a 
>> marquee use case of named arguments. A proposal that works itself out 
>> of that opportunity cannot and should not be acceptable.
> 
> I'm personally not a fan of those argument lists the size of the Magna 
> Cartas like you see in Python libraries:
> https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.lines.Line2D.html#matplotlib.lines.Line2D 

Abuse is a possibility.

> In many cases (like the recent scope/@safe related proposals) I agree 
> that implementing only part of a design has little value, but in this 
> case the proposal has merits even in this limited form. Take for example 
> this line:
> 
> glfwCreateWindow(1280, 720, "my window", null, null);
> 
> You can easily guess what the first three arguments are, but what about 
> those two nulls? It could be made clearer like this:
> 
> glfwCreateWindow(1280, 720, "my window", fullScreenMonitor: null, 
> parentWindow: null);
> 
> You can't leave `fullScreenMonitor` to the default while passing 
> `parentWindow` with this DIP, but writing out that argument doesn't seem 
> like a big loss to me. And even if it is, limitations can easily be 
> lifted without much friction. If it turns out that reordering causes 
> problems down the line, deprecating them would be more of a hassle.

Funny you should mention this, because the obvious problem is this 
doesn't work:

glfwCreateWindow(1280, 720, "my window", parentWindow: null, 
fullScreenMonitor: null);



More information about the Digitalmars-d mailing list