Re:John Carmack working on Scheme as a VR scripting language
by ahoge on Wednesday July 01, 2015 @10:01AM
(#9811824)
> You get to the end and all of a sudden the }();
With most code conventions, you wrap immediately invoked function expressions (IIFEs) in parens:
var foo = (function () {
...
}());
The only purpose of those extra parens is to act as marker.Well, with block scope (`let` & `const`), IIFEs aren't really needed anymore.
The worst example is immediate function application in JavaScript. You get to the end and all of a sudden the }(); tells you everything you've just read is a different context than you thought it was. In Scheme (and probably most Lisps) you'd recognize immediate function application at the beginning as soon as you saw ((.
I don't know how people get really good at JavaScript without learning Scheme first.