News for hackers. Stuff that matters.
Re:Reconsidering Functional Programming by Kiro on Monday May 04, 2015 @03:01AM (#9484712)
What is proper lexical scoping? Does JavaScript get it right?
Re:Reconsidering Functional Programming by coldtea on Monday May 04, 2015 @04:42AM (#9485011)
No. Javascript gets it horribly wrong without "var", still terribly wrong with "var", and somewhat better with "let".
Re:Reconsidering Functional Programming by Kiro on Monday May 04, 2015 @06:14AM (#9485251)
I don't understand what let has to do with functional programming though (enclosing a variable within if () {} instead of function block etc). Do you mind elaborating?
Re:Reconsidering Functional Programming by coldtea on Monday May 04, 2015 @06:52AM (#9485370)
The question wasn't about functional programming per se, but about lexical scope.

"let" keyword in ES6 allows Javascript to have "lexical" style scoping (with some caveats due to JS legacy).

That said, several ways of scoping a variable can be had in functional programming. Have a look here for some more explanation with regards to Common Lisp:

http://stackoverflow.com/questions/463463/dynamic-and-lexica...

Re:Reconsidering Functional Programming by ufo on Monday May 04, 2015 @10:07AM (#9486192)
The "this" keyword is also a mess. I wonder when well be able to start using the new arrow-syntax lambdas everywhere.