D and WebAssembly (Wasm)

Kenneth Dallmann fake at 123.con
Mon Sep 13 16:47:16 UTC 2021


On Monday, 13 September 2021 at 16:36:28 UTC, Paul Backus wrote:
> On Monday, 13 September 2021 at 16:19:31 UTC, Kenneth Dallmann 
> wrote:
>> With D not being able to be run on Wasm in a meaning way: Why 
>> can't
>> we just compile D code to C, as a compiler output, and then 
>> run that
>> through Emscripten?
>
> The [D language runtime][1] uses inline assembly for some 
> low-level features (e.g., threads), and therefore cannot be 
> compiled to C.
>
> Emscripten itself has [similar limitations.][2]
>
> [1]: https://github.com/dlang/druntime/
> [2]: 
> https://emscripten.org/docs/porting/guidelines/portability_guidelines.html#code-that-cannot-be-compiled


My bad, you got that correct.  I guess someone would have to 
write a compiler/RTL specifically
for D to run it on Wasm.  I noticed that threads is one feature 
disabled in BetterC, and maybe that's why it has been ported to 
Wasm.


More information about the Digitalmars-d mailing list