D and WebAssembly (Wasm)

jfondren julian.fondren at gmail.com
Mon Sep 13 16:35:40 UTC 2021


On Monday, 13 September 2021 at 16:29:45 UTC, jfondren wrote:
> On Monday, 13 September 2021 at 16:19:31 UTC, Kenneth Dallmann 
> wrote:
>> Why can't
>> we just compile D code to C, as a compiler output, and then 
>> run that
>> through Emscripten?
>
> The immediate problem is that a D->C compiler does not exist.

https://theartofmachinery.com/2018/12/20/emscripten_d.html 
explains that C isn't necessary:

>Emscripten is a toolchain designed for C/C++, but the C/C++ part 
>is just a frontend. The toolchain actually compiles LLVM 
>intermediate representation (IR). You can generate LLVM IR 
>bitcode from D using LDC, so it should be possible to feed that 
>through Emscripten and run D in a browser, just like C/C++.


More information about the Digitalmars-d mailing list