[OT] Spaces/tabs (Was: simple display (from: GUI library for D))

spir denis.spir at gmail.com
Thu Apr 14 03:39:22 PDT 2011


On 04/13/2011 11:44 PM, Andrei Alexandrescu wrote:
> On 4/13/11 4:17 PM, "Jérôme M. Berger" wrote:
>> Well, standard (printed) typographic practices put spaces outside
>> the parenthesis and none inside. And as opposed to a lot of
>> typographic rules, that one is a constant across languages and variants.
>
> Math typography rules also preclude inserting a space between a function's name
> and the opening brace. That's why I consistently go with no space after the
> opening paren or before the closing paren. Also, that's why there's no need to
> make if (condition) and func(args) consistent with regard to space before
> opening paren. In the first case the paren is pure punctuation; in the latter
> it is an organic part of the function invocation syntax. So one should never
> leave a space between function name and opening paren, and decide independently
> regarding the existence of a space between if/while etc. and the opening paren.

Agreed.
In the same vein, function definition is not a function call; thus I use to write:

	int square (int n) {
	    return n * n;
	}
	sq = square(3);

Actually, I have never been pleased that func defs (1) look like func calls (2) 
have an exceptional syntax compared to other definitions. I'd like instead eg:

	square = function (int n) int {
	    return n * n;
	}

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list