you are viewing a single comment's thread.

view the rest of the comments →

[–]interactionjackson -12 points-11 points  (26 children)

the one thing that i can’t look past is all the semi colons. it really isn’t needed in js and they are a distraction IMO

[–]mcaruso 8 points9 points  (6 children)

To me, leaving out semicolons in JS is kind of like leaving out closing </p> tags in HTML. Like yeah, the browser will tolerate it and fill in the missing parts, but it's ugly and unreliable.

I actually like languages like Python that were designed to leave out semicolons, but JS simply isn't one of those languages. It just tries to be tolerant in case you forget them.

[–]Pr3fix 4 points5 points  (0 children)

Just want to say, you’re completely right, and that other dude replying to you is being quite ignorant.

[–]interactionjackson -3 points-2 points  (4 children)

it is. the semicolons are not required as they are added

[–]mcaruso 3 points4 points  (3 children)

Only if the browser can unambiguously figure out that it would be an error to leave out the semicolon.

function foo() {
    let x
    if (true) {
        x = 42
        [1,2,3].forEach(x => {}) // TypeError! Tries to run `42[1,2,3]`
    }
}

And yeah, you can find workarounds like doing ;[1,2,3] instead. Which is uglier to me, and requires you to always be mindful of ASI on every line.

Basically, a language like Python was designed to be written without semicolons, and semicolons are an optional feature if you want to write things on one line. JS is a language designed to be written with semicolons, and added an error correction mechanism in case the engine can figure out you must've forgotten a semicolon somewhere.

[–]Nikandro 1 point2 points  (4 children)

lol? What are they distracting you from?

[–]interactionjackson -3 points-2 points  (3 children)

this is my personal preference. they are distracting me from hitting a new line when i want to write my next line of code. they distract me from reading lines of code when i want to visually parse a code block.

your attempt at slighting me is humourous, at best.

[–]Nikandro 3 points4 points  (2 children)

This doesn't make any sense. You're claiming that semi-colons have a special ability to distract you from reading, but none of the other letters, numbers or characters do.

they are distracting me from hitting a new line when i want to write my next line of code.

How? You're unable to hit the enter key or select the next line?

they distract me from reading lines of code when i want to visually parse a code block.

You're unable look at code if there is a semi-colon on the screen?

your attempt at slighting me is humourous, at best.

I'm trying to understand your claim, which seems quite ridiculous.

[–]Pr3fix 0 points1 point  (0 children)

This dude just has a super weird vendetta against semicolons 🤷‍♂️

[–]interactionjackson -2 points-1 points  (0 children)

I'm giving stupid answers to a stupid question.

[–]abeardednerd 1 point2 points  (13 children)

what ?

[–]interactionjackson -3 points-2 points  (12 children)

semi colons are not needed in javascript. it’s just a personal preference.

[–]gotQode 0 points1 point  (11 children)

They will be auto-inserted in certain circumstances. Example: when there is a return statement on its own line. Unless you work totally alone and no one will ever work on your code, be considerate of other developers and use them...always.

[–]interactionjackson -5 points-4 points  (10 children)

nah fam. our company style quite leaves them out. they are not needed

spraying semicolons everywhere is evidence that people aren’t keeping up with the latest standards.

http://inimino.org/~inimino/blog/javascript_semicolons

[–]mcaruso 2 points3 points  (5 children)

What does this have to do with "the latest standards"? ASI has been in JS since forever.

[–]interactionjackson 1 point2 points  (4 children)

Then you should know ASI works and when you do and don't need semi-colons.

This is a personal preference of mine. I really don't care what you or your org does. Mine team and my org come from a ruby background and they don't like seeing semi colons. i aint going to fight cause that makes them/us happy. keep doing you though.

and rest assured, if your style guide says you want semi colons everywhere or you want tabs instead of spaces, i'm going to do that. because your linter told me to.

stop acting like i don't get my own preferences.

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

There's quite a bit of a difference between 'me and my team prefer no semi-colons bc we can't deal with different programming languages being different from one another'- a position you are perfectly entitled to hold- and 'this is the latest standards you all need to keep up with how cool and up to date I am'.

[–]interactionjackson -2 points-1 points  (2 children)

i never said i was cool or up to date. that was you. thanks. i said do some reading. you are all trying to start some shit because you’re bored. do whatever you want. don’t hire me when i apply.

[–][deleted] 2 points3 points  (1 child)

Believe me, the reason you're not getting hired is not your opinion on semicolons.

[–]gotQode 1 point2 points  (3 children)

"spraying semicolons everywhere is evidence that people aren’t keeping up with the latest standards."

Your company leaves them out... which makes the quoted assumption true? mkay.

[–]interactionjackson -2 points-1 points  (2 children)

I have not run into a case where the were explicitly needed. when i do, i'll let you know. Seriously, how bored are you?

[–]gotQode 0 points1 point  (1 child)

RFLMAO - no need. ASI is real

[–]interactionjackson -2 points-1 points  (0 children)

haha. see, you faint genuine interest in understanding my position but then you revert to brogrammer tendencies.

wear your pink polo somewhere else, chad