Am 23.01.2012, 17:21 Uhr, schrieb Trass3r <[email protected]>:

Just discovered this LLVM-to-Javascript translator: http://emscripten.org/
Looks really interesting, they even converted CPython.

Might be interesting for D as well.
Question is how the low-level stuff in druntime would work out.

I've seen that a while ago. I wrote the visualizer (or replay viewer) for aichallenge.org and had to cover an applet for older IEs, a HTML 5 version for standards complient browsers and an standalone application. Back then I decided to write the viewer in JavaScript and use a Java JavaScript engine (Rhino from Mozilla) to wrap it into a cross-platform desktop application and an applet all at once. Quite literally even, since the JAR file worked as an applet and standalone application.

In parallel I made my first steps with D2 and when the CTFE regex came out, I wondered if DMD could compile my JavaScript to native code.

Then I found emscripten and that opens a whole new alternative: To write the viewer in Python/C/D and let emscripten generate JavaScript. There is even a version of Gtk (and Cairo?) running in JavaScript, so the graphics should not be a problem either. Once the converter is rock solid, it is definitely easier to run unit tests with a native application, than it is with JavaScript, especially with its lack of strong typing. It is a scripting language after all.

Reply via email to