Has anyone else taken a tour through their codebase?
Actually, what the hell, I'll download haskell, run their interpreter, and see about getting the underscore.js test suite to run.
Has anyone else taken a tour through their codebase?
Actually, what the hell, I'll download haskell, run their interpreter, and see about getting the underscore.js test suite to run.
There have been a few attempts to formalize the semantics of JS, but the lambdaJS approach is the most practical: by factoring out the incidental details (the "syntactic sugar") as a translation ("desugaring") to a kernel language, any work you do on the formal semantics of the language only has to focus on the smaller kernel.
This is also a really practical way to approach building tools for JS, like static analysis: if you design a single desugaring pass as a translation, then you can build a whole bunch of tools on the kernel language. Same idea roughly as the standard compilers approach of translating to an IR.
But that said, having read through their blog posts, I was under the impression that their interpreter doesn't in fact support all of the SpiderMonkey test suite, and so, as a practical matter is still only supporting a subset of JS.
My attempts to get underscore working have been unsuccessful thus far (the debug info isn't terribly useful, not knowing their codebase).
Dave
Another implementation of the core semantics + desugaring approach, dubbed S5 (https://github.com/brownplt/lambdas5), is better engineered and actually uses SpiderMonkey's parser to handle more programs.
S5 runs underscore.js without any issues. Do give it a shot if you're still interested in trying things out.
Also, it's worth mentioning that S5 handles features of the new ECMAScript 5 specification, like strict mode, getters and setters, and new APIs, that the original λJS simply doesn't handle, so it's a much more complete account of JavaScript.
I lament that HN has lost its way enough that this thread didn't make it anywhere near the top of the homepage.