D to Javascript converter (a hacked up dmd)

sclytrack sclytrack at hotmail.com
Tue Feb 28 23:48:54 PST 2012


On 02/28/2012 08:56 PM, Adam D. Ruppe wrote:
> On Tuesday, 28 February 2012 at 19:27:57 UTC, Piotr Szturmaj wrote:
>> Can it compile a function to native code and JS simultaneously? I want
>> to execute the same code on both client and server side.
>
> You'd have to run dmd twice because it exits before getting
> to the backend when doing js.
>
> But you can run the same code:
>
> dmd -md file.d # outputs file.js
> dmd file.d # outputs file.exe
>
>
> You might need versions or something for library support,
> but that's just because I haven't ported much over yet.
>
>
> I just now tried:
>
> import std.algorithm;
> auto range = sort!"a < b"(["b", "a"]);
> window.alert(range.front);
>
> .. and it produced 44 KB of Javascript
> code that *almost* worked.
>
> Looks like I have to fix the dollar expression,
> but otherwise, almost usable.


Do you already have a name for the compiler?


More information about the Digitalmars-d-announce mailing list