this is almost a workaround for the lack of named parameters

John Colvin john.loughran.colvin at gmail.com
Sat Mar 23 08:55:35 PDT 2013


On Saturday, 23 March 2013 at 15:00:13 UTC, bearophile wrote:
> foobar:
>
>> Code that needs named parameters to be more readable is poorly 
>> designed code in the first place.
>
> Have you used a language where the usage of named arguments is 
> idiomatic, like Python, Scala or Ada? They are sometimes useful 
> even for well designed code, like functions with two arguments.
>
> Bye,
> bearophile

A simple example is matplotlib.pyplot.plot

There are so many possible flags and parameters that can be 
passed in order to get the exact behaviour you want, but commonly 
you'll only want a few set for each call. You don't want to have 
to set all the other preceding parameters, you just want to go 
e.g. plot(data, linewidth=5)


More information about the Digitalmars-d mailing list