News for hackers. Stuff that matters.
Re:Opal: Ruby to JavaScript Compiler by munificent on Thursday June 05, 2014 @04:58PM (#7854424)
> You can compile a Ruby VM from C to JS, as people have done.

That sounds to me like it would just kill your startup perf. Users would have to download an entire Ruby VM every time they hit your site, wouldn't they?

Maybe I'm just a luddite, but spending network resources downloading a garbage collector written in JS only so that I can run it in JS... which natively supports GC just seems really gross to me.

Don't get me wrong, I think Emscripten is very very cool. It just feels like a strange fit for applications written in a language whose semantics aren't that far from JS.

Re:Opal: Ruby to JavaScript Compiler by azakai on Thursday June 05, 2014 @05:04PM (#7854480)
I see your point, but don't think it is quite as bad as that. For one thing, it would be cached etc., so it is about as bad as every site on the web using jQuery (that is, not great, but not horrible either).

Yes, it seems ironic to download a GC written in JS, when JS can do GC. But JS can only do SOME types of GC. For example, it lacks destructor callbacks, which things like Lua require. Some other language might need weakrefs which JS also lacks. So it is not quite that unreasonable to download a GC, as you can get the right semantics you want.

But I do agree it gets less clear when the semantics are very close to JS. I'm not sure if Ruby is close enough, though (CoffeeScript certainly is).

Re:Opal: Ruby to JavaScript Compiler by rapind on Friday June 06, 2014 @11:58AM (#7858650)
While convoluted, I believe this results in some pretty fast js. mruby -> llvm -> emscripten -> asm.js

See: http://vimeo.com/70673036