|
|
|
|
|
by pcwalton
3783 days ago
|
|
> Go's lexical scoping and first class function/method's owe a lot to JS for leading the way IMHO. I don't think this comment deserves the downvotes. JS deserves a lot of credit for doing scoping right in 1995, at a time when most popular languages (i.e. not Lisp or ML) were doing it wrong. (A notable exception was Perl 5, which did scoping right in 1994.) Thanks to JS, a lot of working programmers who would never be exposed to Lisp learned lexical scope. Remember that Emacs Lisp famously chose dynamic scope over lexical scope (a serious blunder) due to RMS's belief that lexical scope couldn't possibly be implemented in a performant way! |
|
Scheme, Lisp, ML: yes. I'd written sizable programs in each of those, I'd worked on rewriting a programming languages course textbook with a professor in college, and I'd studied On Lisp. One of the initial test cases was Paul Graham's accumulator generator: https://github.com/golang/go/blob/0f4f2a6/test/closure.go
Javascript: no. At that time (Feb 2009) I doubt I even knew Javascript had lexically-scoped closures. I know I didn't buy 'Javascript: The Good Parts' until March 2010. Even today I don't think the fact that Javascript got closures right is particularly remarkable, except that, as Crockford demonstrates, that fact serves as the fundamental saving grace that enables forgiveness of many other problems.