News for hackers. Stuff that matters.
Re:Javascript and semicolon insertion by orangecat on Saturday May 29, 2010 @06:40PM (#1389400)
A horrible Javascript misfeature, second only to default global scope. I always use semicolons, but as the article notes even if you do that you still have to be aware of how automatic insertion works.
Re:Javascript and semicolon insertion by notauser on Sunday May 30, 2010 @03:29AM (#1390177)
From the article, the only really nasty things are:

  [a].forEach(fn(){})
  [b].forEach(fn(){})
  // Parses as [a][b]

  return
  a+b
  // Parses as return;
You would have to work pretty hard to trigger the rest.

I'm curious about the speed trade offs from removing semicolons. You shrink the source code a little, but does the parser throwing exceptions all the time bump up execution time?

Re:Javascript and semicolon insertion by barrkel on Sunday May 30, 2010 @01:39PM (#1390807)
A parser would not normally handle this kind of thing with exceptions, and any cost would only be paid once, at parse time when building a syntax tree, not at execution time. Very few languages interpret text directly, rather than interpreting trees, as the trees are far easier to work with, more efficient, etc.
Re:Javascript and semicolon insertion by mdaniel on Saturday May 29, 2010 @09:05PM (#1389617)
I realize this is not the forum for this, but hopefully it will serve as a warning to others: the linked article does not scroll on the iPhone (horiz or vert orientation).

"Cool" layouts are all fun and games, but usability is king.

Re:Javascript and semicolon insertion by noblethrasher on Saturday May 29, 2010 @11:16PM (#1389854)
It does but you have to use two fingers.
Re:Javascript and semicolon insertion by frofro on Sunday May 30, 2010 @01:15AM (#1390026)
Yup, I only learned about this feature a few months ago. It also makes other apps like the standard Google Reader usable.
Re:Javascript and semicolon insertion by inimino on Monday May 31, 2010 @04:17PM (#1393385)
It seems to be an issue with the iPhone and iPad. Hopefully Apple will fix it, as I'm sure there are other sites with scrollable areas within a page.

If not, I'll probably find a workaround eventually.

Re:Javascript and semicolon insertion by tszming on Saturday May 29, 2010 @10:48PM (#1389800)
Re:Javascript and semicolon insertion by cmelbye on Saturday May 29, 2010 @09:03PM (#1389612)
Frames? Is it the 90s again?
Re:Javascript and semicolon insertion by inimino on Monday May 31, 2010 @04:13PM (#1393378)
No, there are no frames.
Re:Javascript and semicolon insertion by pdx on Saturday May 29, 2010 @08:22PM (#1389558)
Every since I started using JSMin, I've needed to add semicolons after all my functions, which is something that I can't seem to remember to do as a habit.
Re:Javascript and semicolon insertion by mkramlich on Saturday May 29, 2010 @07:49PM (#1389505)
this issue and the 'var' keyword are two of the reasons I feel Python is mostly a superior language. (Not necessarily completely, just overall.)