4 ms·
Crockford called it "Lisp in C's Clothing" and then created this: http://www.crockford.com/javascript/little.html http://www.crockford.com/javascript/little.htm
by bgarbiak 14y ago
Crockford called it "Lisp in C's Clothing" and then created this: http://www.crockford.com/javascript/little.html http://www.crockford.com/javascript/little.html
- Jach 14y agoI like the comparisons with ClojureScript: http://himera.herokuapp.com/synonym.html http://himera.herokuapp.com/synonym.html The major thing that continues to really annoy me about JS is the lack of proper lexical scoping, other deficiencies are just slight annoyances now (especially with a couple libraries that help the language be tolerable in certain use cases--e.g. https://github.com/coolaj86/futures https://github.com/coolaj86/futures).
- klibertp 14y agoJS has no "proper lexical scoping"? How so? I'm really curious... what your definition of "proper" is here, because JS definitely has lexical scoping.
- jerf 14y agoPaste this into your browser location bar (it won't navigate away): javascript:void(function(){a = 1; {var a = 2;} alert(a)}()) That var a doesn't declare a new var within its scope, it declares it in the function, plus it is counterintuitive how that var a "retroactively" makes that local scope. Javascript has lexical scoping, but only within functions, not within all the scopes other languages have.
- secoif 14y agoYou want block scoping. Block scoping is coming in ES6 with the let keyword.
- klibertp 14y agoPython is the same here, for example, any many other languages too. Making `a` a local variable here is rather ugly thing to do, but it's (somewhat) consistent with how `function` keyword (not an expression) works. The point being: JS implements full and proper lexical scoping; implementing lexical scoping for every block is not a requirement for having lexical scoping.
- draegtun 14y ago> "Lisp in C's Clothing" And Perl probably has an even greater claim to this because it shares 6 of the 7 What Makes Lisp Different? things described by Norvig.