D to Javascript converter (a hacked up dmd)

Adam D. Ruppe destructionator at gmail.com
Mon Feb 27 07:23:19 PST 2012


On Monday, 27 February 2012 at 12:10:17 UTC, node wrote:
> Does this mean I can do node.js in D? :)

Probably. When I did my testing, I ran the code in
dmdscript and later, firefox. The javascript it outputs
is pretty basic so I imagine it will work in any
engine.

To access the library, you can define them as
extern(js) functions or classes, and then some
global objects. In my code, check out src/test/browser
for examples - that package is just bindings to the
browser's functions.

Those are translated to javascript almost exactly
as you write it in D, giving access to the outside
world pretty naturally.



Remember though two important facts:

1) there's no optimization here. The D compiler just
spits out the code tree in the new language. So, don't
expect speed bonuses.

2) Not all of D works. But, a decent chunk of it does
and I think it's ready for some serious playing already.


More information about the Digitalmars-d-announce mailing list