Can we ease WASM in D ?

Adam D Ruppe destructionator at gmail.com
Wed Nov 16 23:00:40 UTC 2022


On Wednesday, 16 November 2022 at 22:51:31 UTC, bioinfornatics 
wrote:
> And since then I ask myself can we at  compile time convert a D 
> code to an extern C code for wasm ?

It would be pretty cool if you could just mark `@wasm` on a 
function and have it magically convert... the dcompute thing i 
*think* does something like this. but im not sure.

> Indeed, if a library/framework  would wrap this to let end user 
> write his code in plain D that would be awesome.
>
> So did you think it is possible to do it by using 
> metaprogramming, mixin, mixin template, mixin string … ?

What I've done before (including the webassembly.arsdnet.net 
website) is have the server call the compiler as-needed when 
requesting the file, which makes it feel pretty transparent. You 
might want to do that too, it'd be on the file level instead of 
on the function level but it works.


More information about the Digitalmars-d-learn mailing list