Live data from Hacker News

Brendan Eich: The infernal semicolon

brendaneich.com

11–20 of 143 posts

Re: Brendan Eich: The infernal semicolon

#11
post #7

The key point: "ASI [“Automatic Semicolon Insertion”] is an error correction procedure. If you start to code as if it were a universal significant-newline rule, you will get into trouble."—Brendan Eich

That doesn't sound right to me. Making s language's syntax more liberal is not a sane way to correct errors. If anything, JavaScript's ASI is an error creation mechanism.

I believe he refers to error correction as in it corrects errors in the code -- i.e. the code itself should have semicolons and is fixed through ASI.

Re: Brendan Eich: The infernal semicolon

#12
The eternal fires of high level bike shedding: semi-colons, whitespace and curly braces, no programming discussion or language can escape all three.

Be liberal in what you accept and conservative in what you send (i.e. just use semi-colons) and your systems will work and play well with others being interoperable.

Re: Brendan Eich: The infernal semicolon

#14
post #7

Earlier quoted context omitted.

That doesn't sound right to me. Making s language's syntax more liberal is not a sane way to correct errors. If anything, JavaScript's ASI is an error creation mechanism.

"Here is your new apartment. You must use a key to enter it. If you forget your key, you can buzz the superintendent during business hours, and if the super is home, (s)he will open the door for you.” If you try to take your key with you at all times, the super will save your bacon once in a blue moon when you forget your key. On the other hand, if you think of the door as only needing a key when you wish to have it…

That's a great analogy.

Re: Brendan Eich: The infernal semicolon

#16

I can't believe that I woke up this morning and more semicolon arguments are at the top of hackernews..

You haven't been around for long enough or just aren'y cynical enough, I went to bed knowing that there would be at least 5 more posts about it in the morning

Re: Brendan Eich: The infernal semicolon

#17
post #10

Moar downvotes! Can we reconsider using this thing as the assembler for the web? Can we come up with a sane, cross-platform bytecode standard?

Feel free to come up with a sane, cross-platform bytecode standard if it sounds doable to you. It doesn't to me.

Why not?

Re: Brendan Eich: The infernal semicolon

#18
I wish I had made newlines more significant in JS back in those ten days in May, 1995.

I wish Brendan was not as skilled a hacker as he was. It's an amazing achievement that he produced Javascript in such a short time. Unfortunately it ended up having the sorts of flaws that are inevitable with such a timeframe, yet it was "good enough" so that everyone decided it was easier to live with the flaws than break compatibility and fix them. If the initial version of Javscript had been worse, we might be using a much better version today.

Re: Brendan Eich: The infernal semicolon

#20
Just because you can doesn't mean you should. A majority of the JS code out has semicolons. Key individuals on the committee responsible for furthering the development of the language recommend always using it. Not including semicolons has shown to result in code errors. It can also introduce build errors when your code is minified. It can also create mental overhead when other developers try to read your code. I just don't get it. Why fight it? Then again, I'm coming from a C/Java background and they just seem so natural to me.
Post reply on HN