3 ms·
It's arguably more error-prone, e.g. Rob Pike justifies Go's decision to use curly braces like so: >Some observers objected to Go's C-like block structure with
by nemo1618 8y ago
It's arguably more error-prone, e.g. Rob Pike justifies Go's decision to use curly braces like so:
>Some observers objected to Go's C-like block structure with braces, preferring the use of spaces for indentation, in the style of Python or Haskell. However, we have had extensive experience tracking down build and test failures caused by cross-language builds where a Python snippet embedded in another language, for instance through a SWIG invocation, is subtly and invisibly broken by a change in the indentation of the surrounding code. Our position is therefore that, although spaces for indentation is nice for small programs, it doesn't scale well, and the bigger and more heterogeneous the code base, the more trouble it can cause. It is better to forgo convenience for safety and dependability, so Go has brace-bounded blocks.
- klibertp 8y agoI never understood this. Whenever I see similar criticism, I wonder: what the heck does its author use to edit programs? Notepad? (Well, given it's Rob Pike and looking at some of his work[1], this time it may well be close to the truth... ;)) [1] http://acme.cat-v.org/ http://acme.cat-v.org/
- enthus1ast 8y agoand then you do both, indents and braces, indents that it looks nice and braces to satisfy the machine. Then you can just omit the braces... If i would just got a penny for each time i've counted braces...