Hacker News new | ask | show | jobs
by jdnier 4098 days ago
I think of it as indicating the function name and parameter list are a unit (it's foo(object), not foo (object)). I've always liked that style.

When I see people write

    'some %s %s text ' %('x', 'y')
my first thought is "% is not not a function".

I'm reminded also of (and agree with) the Crockford convention in JavaScript recommending a space in

    function () {...}
but not in

    function foo(object) {...}
But conventions are are a choice made; most times it's easier to adopt them and move on.
1 comments

>> But conventions are are a choice made; most times it's easier to adopt them and move on.

Which brings me to a related question. Just like color-schemes are preferences in editors and IDEs, why isn't such spacing too. Then it would not be a "choice made" a priori for all individuals.

Because colors can be altered in any end-reader's IDE/text editor. Indentation and spacing, however, can not. At least, not safely yet.

I suppose you could run all the code you receive and have to read through a code-formatter such as YAPF. That way, no matter what "way" someone writes their code, when you read it, it'll be in your comfortable/preferred format.

Colour schemes aren't part of the text itself. However, if your IDE could automatically display your code formatted as you like while keeping the underlying text file aligned with some convention, and make that not a nightmare while editing...well, I think you're onto something there.