News for hackers. Stuff that matters.
Re:Js.js - A JavaScript interpreter in JavaScript by charliesome on Monday January 02, 2012 @08:06PM (#3418154)
It's probably cheating a little to just grab an existing Javascript interpreter written in C++, compile that with emscripten and call it a Javascript interpreter in Javascript. When you compile C++ code, do you say that the program is in Assembly?
Re:Js.js - A JavaScript interpreter in JavaScript by jterrace on Monday January 02, 2012 @08:25PM (#3418207)
Agreed, it's partially cheating, although a lot of work went into getting it to compile to LLVM and patching it work with Emscripten. That's not where it stops though. The plan is to make the library work just like the SpiderMonkey JS API, which will require wrapper scripts in JS.
Re:Js.js - A JavaScript interpreter in JavaScript by rpearl on Monday January 02, 2012 @06:27PM (#3417861)
This appears to be the same goal as https://github.com/mozilla/narcissus/ but substantially less clever.
Re:Js.js - A JavaScript interpreter in JavaScript by MatthewPhillips on Monday January 02, 2012 @06:46PM (#3417919)
Isn't Narcissus primarily for developing Harmony features?
Re:Js.js - A JavaScript interpreter in JavaScript by gkoberger on Monday January 02, 2012 @08:50PM (#3418277)
Other than prototyping new JS features (or to say you did it), what's the use? It will never come close to being fast enough to be a viable alternative, like PyPy is.
Re:Js.js - A JavaScript interpreter in JavaScript by rpearl on Monday January 02, 2012 @11:40PM (#3418640)
err... what's the goal of the featured link, js.js? It's even worse--all of Spidermonkey compiled to llvm and then to javascript.
Re:Js.js - A JavaScript interpreter in JavaScript by cjfont on Monday January 02, 2012 @06:26PM (#3417857)
Any thoughts as to applications for this? At ~65MB, I don't see this getting used client side.
Re:Js.js - A JavaScript interpreter in JavaScript by Animus7 on Monday January 02, 2012 @06:32PM (#3417874)
I don't even think the worst part is the download (which can be cached). The worst part is the fact that you're running your script, interpreted by a weirdly generated unoptimized script, interpreted by a scripting engine which only then runs on metal. I'm shooting in the dark, but I'd bet the performance and memory usage would be a disaster for anything but Hello, world.
Re:Js.js - A JavaScript interpreter in JavaScript by spullara on Monday January 02, 2012 @08:01PM (#3418143)
Actually, right now, even Hello world is a disaster. My guess is that this will drive some interesting improvements to emscripten and LLVM so there may be some benefits down the line.
Re:Js.js - A JavaScript interpreter in JavaScript by wahnfrieden on Monday January 02, 2012 @07:08PM (#3417985)
There's also going to be an enormous startup time as it has to parse and compile all that code, even if it's already cached.
Re:Js.js - A JavaScript interpreter in JavaScript by jterrace on Monday January 02, 2012 @06:41PM (#3417901)
65MB is our current unoptimized, uncompressed version. I expect the final version to be around 5-10MB. Still large, but not quite as bad.
Re:Js.js - A JavaScript interpreter in JavaScript by cdata on Monday January 02, 2012 @10:01PM (#3418418)
I'm not super familiar with Narcissus in practice, but on paper your projects sound very similar. Were there any interesting reasons why you opted to make this project instead?
Re:Js.js - A JavaScript interpreter in JavaScript by jterrace on Monday January 02, 2012 @10:03PM (#3418421)
We wanted the full power of the SpiderMonkey JS API and maximum browser compatibility.
Re:Js.js - A JavaScript interpreter in JavaScript by jakejake on Monday January 02, 2012 @08:57PM (#3418291)
i can see some possible for this where you could add support to your application for plugin development or even macro-type scripting within a sandbox.
Re:Js.js - A JavaScript interpreter in JavaScript by aarondf on Monday January 02, 2012 @06:35PM (#3417884)
I believe this is how Cobb and Saito slipped into Limbo.
Re:Js.js - A JavaScript interpreter in JavaScript by _Y_ on Monday January 02, 2012 @07:16PM (#3418013)
Or how another cheap "Yo dawg" joke started.
Re:Js.js - A JavaScript interpreter in JavaScript by cdcarter on Monday January 02, 2012 @06:28PM (#3417862)
The best part is that the blob is too big to explore on github.
Re:Js.js - A JavaScript interpreter in JavaScript by joshfraser on Monday January 02, 2012 @09:41PM (#3418382)
There are plenty of things I've done in my life that didn't make a lot of sense, but I did them just because I could. I'll happily put js.js in the same bucket and give props for creativity over usefulness.
Re:Js.js - A JavaScript interpreter in JavaScript by AshleysBrain on Monday January 02, 2012 @07:12PM (#3417998)
Page seems to be missing a "why?" section. Seriously, why? What does it do that eval() doesn't?
Re:Js.js - A JavaScript interpreter in JavaScript by stan_rogers on Monday January 02, 2012 @07:53PM (#3418125)
It's similar to the metacircular Scheme interpreter in Scheme in SICP. It's not that interpreting JavaScript in JavaScript (especially if that JavaScript is running on a full-blown and more efficient interpreter itself) is a practical end, but that it demonstrates a concept: language as data and data as language. As an implementation, it is merely interesting -- but imagine writing code in a language closer to the problem domain you're working with that just happens to run on JavaScript.
Re:Js.js - A JavaScript interpreter in JavaScript by zacharytamas on Monday January 02, 2012 @06:46PM (#3417918)
These kinds of things always make me think of PyPy and its snake-eating-itself (ouroboros) logo.
Re:Js.js - A JavaScript interpreter in JavaScript by lukeholder on Monday January 02, 2012 @06:25PM (#3417852)
so eval() written in js?
Re:Js.js - A JavaScript interpreter in JavaScript by jterrace on Monday January 02, 2012 @06:43PM (#3417909)
Not quite. It will support everything that SpiderMonkey's API supports when embedding the interpreter into a C++ application. Much more powerful than eval().
Re:Js.js - A JavaScript interpreter in JavaScript by gootik on Monday January 02, 2012 @08:49PM (#3418273)
A very good example of Atwood's Law: any application that can be written in JavaScript, will eventually be written in JavaScript.
Re:Js.js - A JavaScript interpreter in JavaScript by LeafStorm on Monday January 02, 2012 @09:05PM (#3418310)
Somehow I don't think this really counts as "written in JavaScript."
Re:Js.js - A JavaScript interpreter in JavaScript by Animus7 on Monday January 02, 2012 @06:24PM (#3417850)
> Instead of trying to create an interpreter from scratch, SpiderMonkey is compiled into LLVM and then emscripten translates the output into JavaScript.

Heh, this is pretty much the epitome of hacking: needlessly complicated, ultimately pointless, but still awesome, clever and inspiring.