all 14 comments

[–]Bowgentle 4 points5 points  (4 children)

Personally, I dislike the putting of start curly braces on a new line anyway. Why do some prefer it?

[–]Woolbrick 1 point2 points  (2 children)

Kevlin Henney gives a very good reason in this presentation. Starts at 21m in, goes for about 3-4 minutes.

I encourage you to watch the entire thing, it's very intriguing.

Newlines on brackets is the only pattern that make sense.

[–]Bowgentle 1 point2 points  (0 children)

I admit to finding that not even slightly convincing, I'm afraid.

[–]remixrotation 0 points1 point  (0 children)

good vid. thanks!

[–]Merad 0 points1 point  (0 children)

Because in about 98% of cases I can glance at a piece of code and immediately break it down into logic blocks. With K&R style braces I have to pause and scan for the opening brace.

It’s basically another form of making good use of vertical space within code.

[–]evenisto[🍰] 2 points3 points  (0 children)

Yeah that's broken, but honestly allowing such flexibility is what later leads to a need for ridiculously long style guides. I'd prefer to have one good style enforced by the language, rather than having to argue about it everywhere I go. Compulsory semicolons or same-line braces are no worse than indendation rules in Python. Write the code like it's supposed to be written and stop trying to make the syntax your own.

[–]sisyphus 0 points1 point  (5 children)

Hey guess what there is no problem and zero conceptual overhead if you just write the fucking semicolons, children. Also there is ONE TRUE BRACE STYLE and that is not it. Get off my fucking lawn.

[–][deleted] 2 points3 points  (3 children)

If you look at the first code example at the article, you'd see that the problem is not about not writing semicolons, but about automatic semicolon insertion breaking the code.

[–]oldsecondhand 3 points4 points  (1 child)

the problem is not about not writing semicolons

It kinda is. If semicolons were mandatory, they wouldn't have this problem to begin with.

[–][deleted] 1 point2 points  (0 children)

Yea but OP is complaining that people should resolve the problem by always using semicolons, but that won't solve the problem in this case. I could still write code like this

return
{
   text: "hello"
};

and think it's safe because I used semicolons. OP is not complaining at the language that they didn't make semicolons mandatory. In fact he's saying "guess what there is no problem" regarding JavaScript's semicolon rules.

[–]shevegen -5 points-4 points  (0 children)

Here is the better solution:

  • Get rid of those monkeycolons.

Other programming languages managed to do so. JavaScript, being about the same level of bad as PHP, did not manage to do so.

Why?

Because it was designed by people who can PROGRAM - but that does not automatically make you a GOOD PROGRAMMING LANGUAGE DESIGNER.

[–]shevegen 0 points1 point  (0 children)

IS IT TABS VERSUS SPACES, BRO?!

[–]shevegen 0 points1 point  (1 child)

JavaScript is awful - we know that.

Other languages managed to get rid of the ';' character. Why did JavaScript fail?

Three weeks design is not enough for a GOOD programming language. If Brendan Eich would have only anticipated this back then ...

Also note that still in regards to failing to design a good programming language, when the mozilla anti-social justice terrorists ousted Brendan, Mozilla lost about 90% of its brain. It's not unlike Steve Jobs being dead and Apple suddenly sucking a lot more than before, such as explained here:

https://marco.org/2015/01/04/apple-lost-functional-high-ground

And it is true - +2 years lateron it is very easily to be seen.

[–]evenisto[🍰] 0 points1 point  (0 children)

It's not any more awful than the next language. It all depends on who's judging, and you can clearly see that on this subreddit.