Pretty please: Named arguments
bearophile
bearophileHUGS at lycos.com
Mon Feb 28 12:40:52 PST 2011
spir:
> <OT>
> By the way, I wonder why people tend to systematically add one, and only one,
> space after ':', ',', ';' and never before. D code is not english!
You want to break English and Math rules only when you have a good reason.
In Python PEP8 is quite specific:
> - Immediately before a comma, semicolon, or colon:
>
> Yes: if x == 4: print x, y; x, y = y, x
> No: if x == 4 : print x , y ; x , y = y , x
> There is no reason to write "width: 123" rather than "width:123" or "width : 123".
"width :123" breaks an English rule for no purpose, and "width:123" is less readable, because there are less spaces that help the eye tell apart the parts of the text. "width : 123" looks more acceptable when you use it as a binding symbol. In functional languages sometimes you use ":" to tie list elements, and you use it with a space on both sides.
Rather
> the opposite, ':' expresses here a link which does not binds tightlier on left
> side than on right side ;-)
> Same about ';': it's a separator that has no reason to stick on left side, and
> not on right side!
In D the ";" is used for purposes similar to English ones, as punctuation to denote when something (like a line) ends, so sticking it to the left is the right thing to do, because both English and most D is read from left to right.
Bye,
bearophile
More information about the Digitalmars-d
mailing list