Hacker News new | ask | show | jobs
by rsc 3782 days ago
I argued for the design of and wrote the implementation for Go's lexical scoping and first class functions, and I can tell you they were in no way influenced by Javascript.

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.

2 comments

I wasn't suggesting that JS directly influenced you. Rather my point was that JS was of the most important languages that brought lexical scoping and closures to the masses. By the time Go came around, it was considered a bog-standard feature, because of languages like JS (and others) that popularized it. That meant that programmers could more easily pick up Go.
Even if JS was not in the back of your mind, you have to admit that the design of "LISP in Cs clothing" (to quote Crockford) turned out nearly identical - certainly much closer than to Scheme, LISP or ML. And JS did it much earlier than Go. My point was that it owed developer comfort with the design to JavaScript, and not necessarily direct design influence.