D to Javascript converter (a hacked up dmd)

Marco Leise Marco.Leise at gmx.de
Thu Mar 1 08:27:03 PST 2012


Am 29.02.2012, 18:32 Uhr, schrieb Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org>:

> On 2/26/12 9:51 PM, Adam D. Ruppe wrote:
>> https://github.com/downloads/adamdruppe/dtojs/dtojs.zip
> [snip]
>
> That's interesting. So the idea is to make an entire subset of D
> convertible to Javascript?
>
> What use cases do you have in mind?
>
>
> Andrei

The visualizer I wrote for aichallenge.org had 3 versions:

- HTML 5 / JavaScript
- Java applet
- Java application

The source code was in JavaScript and executed in the Rhino JS engine for the Java versions. The applet was actually there to support Internet Explorer versions which suffered from a massive NIH syndrome when it came to HTML 5. So with those becoming a minority the remaining targets are the standalone application and the browser visualizer.
With D-to-JS I would have had the option to write the application in D using GtkD or similar GUI library with access to drawing functions that are similar to the HTML 5 Canvas, and then export the whole thing to JS. The obvious benefits are to me:

- Native efficiency (JS in Rhino in JVM used masses of memory and was slow as molasses)
- Type checking and compiler errors

The downside is that I would have missed the perfect JavaScript debugging support in the major browsers when working with D code. :)


More information about the Digitalmars-d-announce mailing list