15 ms·
The Java style guide from Sun does this: http://java.sun.com/docs/codeconv/html/CodeConventions.doc5.html#2991 http://java.sun.com/docs/codeconv/html/CodeConve
by mechanical_fish 18y ago
The Java style guide from Sun does this:
http://java.sun.com/docs/codeconv/html/CodeConventions.doc5.html#2991 http://java.sun.com/docs/codeconv/html/CodeConventions.doc5....
The PEAR PHP coding standards recommend this:
http://pear.php.net/manual/en/standards.php http://pear.php.net/manual/en/standards.php
And, as has been pointed out, if you don't do this in Javascript the JS interpreter will helpfully insert bugs for you (in the form of extra semicolons).
When Ruby uses braces at all, opening braces are placed at the ends of lines. (Usually the closing braces are on the same line, though... most multi-line Ruby blocks use the "do...end" keywords.)
The issue doesn't come up in Python at all, right? Likewise Lisp.
So it seems that only programmers who take up C as a first language will be exposed to the opening-brace-on-its-own-line style before they become used to the other style.
- biohacker42 18y agoMy order of language takeup: C++/Python/Lisp. But yeah it's a C thing. Never the less, this{ } Is an abomination!
- DanielBMarkham 18y agoIt's so wrong the poor folks can't even see it. I understand that it came from Java. But even when I code in Java I'm braces-stand-alone. And this bit about semicolon insertion? Lies. All lies I tell you.
- PaulMorgan 18y agoZend framework also agrees with the PEAR PHP standard - 4 spaces for indentation with no tabs allowed: http://framework.zend.com/manual/en/coding-standard.php-file-formatting.html#coding-standard.php-file-formatting.indentation http://framework.zend.com/manual/en/coding-standard.php-file...