5 ms·
Some thoughts/questions about asm.js 1) I understand the C/C++ -> LLVM -> Emscripten -> asm.js process. But I heard they're also working on supporting GC lang
by cpprototypes 13y ago
Some thoughts/questions about asm.js
1) I understand the C/C++ -> LLVM -> Emscripten -> asm.js process. But I heard they're also working on supporting GC languages (like Java and Go). How would this work exactly? Wouldn't they first have to port the entire JVM or Go runtime into asm.js? And every time a Java/Go -> asm.js program is downloaded, it would basically also download the entire JVM/Go runtime as well?
2) Would it be possible to use GUI frameworks (like Qt for C++ and maybe Swing for Java in the future) to build GUIs and directly output to canvas?
- camus2 13y agoQt running in the browser : http://badassjs.com/post/43158184752/qt-gui-toolkit-ported-to-javascript-via-emscripten http://badassjs.com/post/43158184752/qt-gui-toolkit-ported-t... JVM running in the browser : http://plasma-umass.github.io/doppio/about.html http://plasma-umass.github.io/doppio/about.html Anything is possible in the browser.
- serge2k 13y agoAnything is possible in brainfuck too. You can also do all your coding in just C++ templates. Doesn't make it a good idea.
- coldtea 13y agoYes, if only using the browser as a platform also had other benefits... Oh, wait!
- serge2k 13y agoI fail to see the benefit of building a jvm to run in a javascript engine. I would rather see effort to develop a better language than JS for the web. Now someone will bring up emscripten and dart...
- coldtea 13y ago>I fail to see the benefit of building a jvm to run in a javascript engine. That's because you picked a very specific example to suit your argument. How about seing the benefit of building games to run in the browser with near native speed? Or something like Mathematica? Or an image editor, etc etc...
- _random_ 13y agoThe long-term plan is to avoid being locked into crappy languages such as JS and HTML/CSS and give developers more freedom.
- GregBuchholz 13y agoSomeone should tackle Squeak on asm.js.
- kalleboo 13y agoWow, those Qt demos are actually really quick and responsive.
- andhow 13y agoFor (1): You're right that an option is to compile the VM itself to asm.js (since the VM is usually written C/C++ code; JITs are an obvious exception since they generate machine code at runtime). This has already been done, e.g., for Java [1] and Lua [2]. What is meant by "supporting GC languages" is translating GC objects in the source language to real JavaScript objects so that the JS GC may be used on them. For statically-typed source languages like .NET/JVM, the proposed Typed Objects extension to JavaScript [3] could be naturally integrated into asm.js to describe classes. This is all a little ways off since Typed Objects needs to be standardized first. Also, the lack of finalizers in JS would limit the fidelity of the translation. For (2): yes, it is already being worked on [4]. [1] xmlvm.org [2] http://kripken.github.io/lua.vm.js/lua.vm.js.html http://kripken.github.io/lua.vm.js/lua.vm.js.html [3] http://wiki.ecmascript.org/doku.php?id=harmony:typed_objects http://wiki.ecmascript.org/doku.php?id=harmony:typed_objects [4] http://badassjs.com/post/43158184752/qt-gui-toolkit-ported-to-javascript-via-emscripten http://badassjs.com/post/43158184752/qt-gui-toolkit-ported-t...