On 12/13/2013 05:40 PM, Manu wrote:
On 14 December 2013 02:12, Timon Gehr <[email protected]
<mailto:[email protected]>> wrote:
On 12/13/2013 05:05 PM, Manu wrote:
Is it idiomatic to use egyptian braces in D?
Brackets? Yes.
[] is brackets, {} is braces.
...
[] // angle brackets
{} // curly brackets, braces
if(..){ // egyptian brackets
}
http://www.codinghorror.com/blog/2012/07/new-programming-jargon.html
Note that egyptian brackets is way easier to google than egyptian
braces, and the latter term does not occur in any of the results on the
first page as far as I can see.
I've never seen D code written this way...
looks like Java.
Not really, no.
No, as in, people 'not really' write D code that way, or no as in, it
doesn't look like java, except that it does, because only it and
javascript have idiomatic egyptian braces... ;)
...
D code does not look like Java code.
I'm just saying, if it's code to be compared against other languages,
then it should conform to the general standards of the language.
The language is whitespace-agnostic except for delimiting tokens.
I've never seen D code use egyptian braces.
I've never heard the term egyptian braces. Also, I don't believe you.
http://dlang.org
Certainly the vast majority of D code doesn't.
The vast majority seems to use the term 'egyptian brackets'.
I don't care which, but stick with one as a
'standard'. D has clearly chosen C braces, not Java braces, all the
standard libraries agree.
...
Well, Phobos is not even fully consistent here,
../dmd-2.064/src/phobos/std$ grep ")\s*{" *.d | wc -l
2070
even if we allow if(...){ } etc.,
.../dmd-2.064/src/phobos/std$ grep ")\s*{[^}]*$" *.d | wc -l
743
If you were going to publish some Java code using C braces,
I don't.
how would you feel about that?
Why does this matter?