News for hackers. Stuff that matters.
Re:StandardJS just turned 10.0.0 by draw_down on Wednesday April 05, 2017 @06:41PM (#14046330)
Well, I agree with that and all. But why type (and more importantly, look at) a bunch of semicolons if you don't have to, ya know?
Re:StandardJS just turned 10.0.0 by RyanCavanaugh on Wednesday April 05, 2017 @06:45PM (#14046370)
Its a good question readers of the English language can also infer punctuation where needed it's not considered good style to make readers infer this there can be some oddness if you are not used to putting punctuation where it belongs naturally garden path sentences can result and some tools can detect ambiguity automatically but why learn some custom rules for that when its straightforward to consistently put periods at the end of sentences
Re:StandardJS just turned 10.0.0 by robertbenjamin on Wednesday April 05, 2017 @06:54PM (#14046445)
Damn, this is clever!

Except that 'punctuation' in JavaScript comes in the form of a line break, and adding a semicolon is like adding two periods to the end of every sentence just in case someone missed the first one.

Re:StandardJS just turned 10.0.0 by wolfgang42 on Wednesday April 05, 2017 @08:42PM (#14047011)
Consider, however, the style commonly used on chats such as IRC

This sort of writing generally leaves off periods on the ends of sentences

sometimes, it even leaves off the capitalization at the beginning, as well

and yet it manages to be entirely readable and generally unambiguous

This is remarkably similar to js's automatic semicolon insertion:

if the sentence makes more sense with a period at the end of the line

then the reader usually inserts one automatically, without thinking about it

Re:StandardJS just turned 10.0.0 by RyanCavanaugh on Wednesday April 05, 2017 @06:55PM (#14046453)
Except for all the times it isn't, which you still have to remember or have enforced by a tool.
Re:StandardJS just turned 10.0.0 by draw_down on Wednesday April 05, 2017 @06:55PM (#14046447)
Oh, don't be silly. I'm not talking about prose.
Re:StandardJS just turned 10.0.0 by 0xCMP on Wednesday April 05, 2017 @08:45PM (#14047022)
Your previous comment read like you now were okay with semi-colons, but I realized now that it's you like no semi-colons. But, in my opinion, the reason you'd be okay with looking at it if you didn't have to is if you wanted to!

JS will add the semicolons. If you're using Babel and the rest you most likely are not going to run into all the weird things to do with semi-colons as long as you follow K&R C style for control statements.

But if you want it to, go ahead. What matters, in the end, is consistency to make it look pretty. The more it looks like a single very smart person wrote it the better.

Re:StandardJS just turned 10.0.0 by codedokode on Wednesday April 05, 2017 @07:56PM (#14046797)
Because JS syntax is copied from Java that uses semicolons. Omitting semicolons makes code more ambigious and one has to remember where they can and where they cannot break a line.

JS is not a language like Ruby or Python.

If someone doesn't like typing semicolons why don't they set up their editor so that it would insert them automatically?

Re:StandardJS just turned 10.0.0 by betenoire on Wednesday April 05, 2017 @06:44PM (#14046363)
Because they signal a complete thought. Like a period.
Re:StandardJS just turned 10.0.0 by iLoch on Wednesday April 05, 2017 @07:01PM (#14046492)
Because it's impossible to complete a thought without a period

Seems like a silly conclusion

Re:StandardJS just turned 10.0.0 by betenoire on Wednesday April 05, 2017 @07:11PM (#14046542)
Obviously it's a preference. But you proved my point to me, your "sentences" look sloppy and incomplete. I try not to write like that, why would I code like that?
Re:StandardJS just turned 10.0.0 by mikerybka on Wednesday April 05, 2017 @07:01PM (#14046488)
So kinda like lines.
Re:StandardJS just turned 10.0.0 by betenoire on Wednesday April 05, 2017 @07:13PM (#14046547)
Kinda. But not. Statements have little to do with lines, and they span lines very often. Variable declarations, especially objects and arrays. Many times for method calls too with many arguments. Kinda.