this is almost a workaround for the lack of named parameters

foobar foo at bar.com
Mon Mar 25 06:28:15 PDT 2013


On Monday, 25 March 2013 at 13:02:49 UTC, bearophile wrote:
> 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

C is a HORRIBLE language regarding naming conventions and is a 
*very poor choice* to learn from in this regard. Python sets very 
high expectations regarding "beautiful code" and IMHO fails 
miserably (more so because of the starting higher expectations).
I admit to being spoiled by actually beautifully designed 
languages that are far superior in that respect. I suggest to 
learn Smalltalk for a language that emphasizes code readability 
decades before Python became cool.
I find Ruby which is based on Smalltalk's semantics and spirit to 
be more elegant and less pretentious compared to Python.


More information about the Digitalmars-d mailing list