this is almost a workaround for the lack of named parameters

bearophile bearophileHUGS at lycos.com
Mon Mar 25 06:02:47 PDT 2013


foobar:

> "idiomatic" is a relative term, tightly coupled to a specific 
> language. Idiomatic D code for example is very different from 
> idiomatic Haskell code.
> Idiomatic Python style in D would be very unidiomatic D code 
> and vise versa. Each language has its own conventions, styles, 
> set of distinct features, etc, etc and trying to use "language 
> A" style while coding in "language B" is like trying to fit a 
> square peg in a round hole.
> For instance, I would NOT use smalltalk naming conventions 
> while writing say Java code. Both have very good and very 
> consistent styles that are tightly coupled with their 
> respective syntaxes and are very unsuitable to use in the other 
> language.
>
> In short, if you want to discuss python features, style or 
> specific math plotting libraries, please post to the python 
> mailing list, not D's NG.

Imperative/OOP languages are not totally different from each 
other, both Python and D derive strongly from C that comes 
partially from Algol, and D copies several things from Python 
(string functions, part of the module system, part of the range 
design comes from itertools, and so on). So comparing languages 
and their features is very useful.

If you have not used named arguments in languages that 
idiomatically use them, then it's not easy for you to see how and 
why they are sometimes useful and good.

In Python function arguments don't have a type, so named 
arguments are more useful than in D. But from my experience in 
Python, I believe D could enjoy named arguments.

Bye,
bearophile


More information about the Digitalmars-d mailing list