Proposal for porting D runtime to WebAssembly

Sebastiaan Koppe mail at skoppe.eu
Sat Nov 23 20:48:51 UTC 2019


On Saturday, 23 November 2019 at 15:23:41 UTC, Alexandru Ermicioi 
wrote:
> On Saturday, 23 November 2019 at 09:51:13 UTC, Sebastiaan Koppe 
> wrote:
>> This is my proposal for porting D runtime to WebAssembly. I 
>> would like to ask you to review it. You can find it here: 
>> https://gist.github.com/skoppe/7617ceba6afd67b2e20c6be4f922725d
>
> I was wondering whats your position on Fibers?

I am not going to support them in this initial port. And to be 
honest I rather see us moving towards stackless coroutines.

> Can they be implemented in current WebAssembly?

I haven't looked into it. I suppose they could be, since go has 
their goroutines supported in wasm as well.

But I don't think it is easy. WebAssembly uses the Harvard 
architecture, which means code and data is separate and code 
isn't addressable. That is why wasm uses a function table and 
indexes instead of function pointer addresses. So things like 
moving the instruction pointer are out.

> If so I'd guess they would be a nice match for async related 
> functionality javascript is known for.

You can still use the JavaScript eventloop, either browser or 
node.



More information about the Digitalmars-d-announce mailing list