Live data from Hacker News

Can You Find the Bug in This Code?

victorzhou.com

61–64 of 64 posts

Re: Can You Find the Bug in This Code?

#61
post #48
post #26

Earlier quoted context omitted.

> I'm yet to see a single case of an upside. It's a signal of coolness from inexperienced programmers. That's the value proposition offered by semicolon-free JS.

I disagree, I think people who really care about semicolons in JS are people who just don't write a lot of JS. I can honestly say in the last 5 years of only writing front-end I have never been bit by ASI.

> people who really care about semicolons in JS are people who just don't write a lot of JS

I started JS in the mid 90's. I still use semi-colons. To me it's like using a period to end a sentence. It's a pause. It defines the end of a statement.

I feel that too much emphasis is placed on the desire to remove curlys and semi colons from JS. It's part of the language. There's always coffeescript or those other flavours that will suit you.

Re: Can You Find the Bug in This Code?

#62
post #60

Earlier quoted context omitted.

> I'm sure they love being told they're wrong because they're young and vain. I wouldn't say that, but it is a decision based on vanity and it does tend to come from younger/junior coders in my experience. Making one bad decision based on vanity doesn't make you vain though IMO. It's not personal vanity either, it's "code vanity" so maybe a better word would be: hasty or risky... Anyway, the effort that it takes to s…

> I wouldn't say that, but it is a decision based on vanity and it does tend to come from younger/junior coders in my experience You're not wrong, but using it as an argument has a counter: people like semis because they're the old-guard curmudgeons afraid of change :) > then you risk running into a bug like the one that broke Twitter Bootstrap due to lack of semis. The bug was due to a JS minifier removing a needed…

> You're not wrong, but using it as an argument has a counter...

I'm not using it as an argument. I'm using it as a descriptor for people who make arguments against semis.

> ASI is intentionally a part of the language spec...

Yes, but it's clearly there as a corrective measure for people who mistakenly omit them. So, the spirit of the language spec and all signs point to: use them.

> I probably would have put it in the spec too, but that doesn't mean I don't set `semi: false` in every React project I start.

To write a spec rule and then immediately ignore it makes no sense to me.

But anyway...why do you not want semis? If you have a tool that automatically inserts them, like prettier or eslint, then the only reason you're making that decision is because you don't like the way they look. That's pretty shallow reasoning IMO.

Re: Can You Find the Bug in This Code?

#63
post #60

Earlier quoted context omitted.

> I wouldn't say that, but it is a decision based on vanity and it does tend to come from younger/junior coders in my experience You're not wrong, but using it as an argument has a counter: people like semis because they're the old-guard curmudgeons afraid of change :) > then you risk running into a bug like the one that broke Twitter Bootstrap due to lack of semis. The bug was due to a JS minifier removing a needed…

> You're not wrong, but using it as an argument has a counter... I'm not using it as an argument. I'm using it as a descriptor for people who make arguments against semis. > ASI is intentionally a part of the language spec... Yes, but it's clearly there as a corrective measure for people who mistakenly omit them. So, the spirit of the language spec and all signs point to: use them. > I probably would have put it in t…

[deleted]

Re: Can You Find the Bug in This Code?

#64
post #60

Earlier quoted context omitted.

> I wouldn't say that, but it is a decision based on vanity and it does tend to come from younger/junior coders in my experience You're not wrong, but using it as an argument has a counter: people like semis because they're the old-guard curmudgeons afraid of change :) > then you risk running into a bug like the one that broke Twitter Bootstrap due to lack of semis. The bug was due to a JS minifier removing a needed…

> You're not wrong, but using it as an argument has a counter... I'm not using it as an argument. I'm using it as a descriptor for people who make arguments against semis. > ASI is intentionally a part of the language spec... Yes, but it's clearly there as a corrective measure for people who mistakenly omit them. So, the spirit of the language spec and all signs point to: use them. > I probably would have put it in t…

> I'm using it as a descriptor for people who make arguments against semis.

Doesn't change the point: "back in my day, we used semicolons everywhere..."

> Yes, but it's clearly there as a corrective measure for people who mistakenly omit them. So, the spirit of the language spec and all signs point to: use them.

I think you're projecting quite a bit here. If you're interested, here's a ticket from TC39 proposing directly discussing possible issues with ASI: https://github.com/tc39/ecma262/pull/1062/files

Point being they're not advocating for using semicolons, but making it clear what the possible edge cases are.

> But anyway...why do you not want semis?

Because I don't want the noise. Yeah, theoretically they might save you some time debugging once in a few million LoC but including them everywhere adds a whole lot of pointless characters.

Post reply on HN