DIP 1019--Named Arguments Lite--Final Review

Dennis dkorpel at gmail.com
Fri Aug 23 19:05:04 UTC 2019


On Friday, 23 August 2019 at 16:47:14 UTC, H. S. Teoh wrote:
> But this DIP neither enables nor disables inordinately long 
> parameter lists: the language already allows them!

It allows them, but it doesn't encourage them. Long parameter 
lists are currently rare in D as they should be.

> The only thing worse than an overly-long parameter list is one 
> in which you cannot (easily) tell which argument corresponds 
> with which parameter, and that's something this DIP would fix 
> (by letting you name the arguments so that they are 
> self-documenting).  So your argument doesn't really detract 
> from this DIP.

If you look at some of the longest parameter lists on Dub:
https://github.com/jmh530/libnlopt/blob/06996b5c415cee2d2edd4efdeec078182fa24879/source/libnlopt/api.d#L300
https://github.com/d-widget-toolkit/dwt/blob/fa6b22597901a21fe51f91fb9628460fc71641fd/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/ImageData.d#L1794
https://github.com/Vild/xcb-d/blob/79e977943b187152924015bea090ee832ae92ef9/source/xcb/xkb.d#L5022
https://github.com/libmir/lapack/blob/1f00f70a15cdf10ba7564eff7e53dac3d070bd56/source/lapack/lapack.d#L651

My first observation is they are courtesy of other languages and 
not original D functions.
Secondly, I don't think "if only we could use named parameters 
with default values, then these functions would be great.".



More information about the Digitalmars-d mailing list