Does the D teams would like to increase the WASM support

bioinfornatics bioinfornatics at fedoraproject.org
Thu Nov 17 22:49:32 UTC 2022


Dear D community,

After the discussion [Can we ease WASM in D 
?](https://forum.dlang.org/post/dwiqircfxdbknhzbzixe@forum.dlang.org)

We all know that D can do wasm code through ldc compiler since 
years. But as the dev experience int so good it is still a toy/an 
experimental thing.

So I would like to know if Dlang aims to provides a better 
experience to code wasm ?

Indeed, currently we have to
1. use D mostly without object.d so it is close to use a D 
compiler to write C code.
2. wrap de code into some llvm statements

```D
// import a function "add" from module name "math" and rename it 
to "add_numbers"
@llvmAttr("wasm-import-module", "math") 
@llvmAttr("wasm-import-name", "add") {
	int add_numbers(int a, int b);
}
```

3. Linux Distro user which use D though deb, rpm … have a shared 
phobos library how to put those symbol into the wasm in such case 
?

4. compiler triple parameters 
`-mtriple=wasm32-unknown-unknown-wasm -betterC`

So it would be really helpful that the compilers and Dlang get a 
better wasm support.
1. As to provides a wasm flag to the compiler to do some stuff
2. tags function `@wasm` or something else
and any others thing that could turn the D wasm toy to something 
usable

As example I would lovo to see  a D library/frameworks that do 
something like [yew](https://github.com/yewstack/yew) from rust 
lang
This code seems pretty clean (only rust), no use of workaround as 
llvm statement or use of C lang though `-betterC`


I would appreciate to get the point of views of D backend, 
`phobos` and `druntime` dev teams

As references:
* 2 years ago, yet! Adam provides some feedback to the D 
community: [D Tetris running on 
Webassembly](http://dpldocs.info/this-week-in-d/Blog.Posted_2020_08_10.html).
* 3 years ago, Sebastian create the 
[spasm](https://github.com/skoppe/spasm) library


Thanks





More information about the Digitalmars-d mailing list