On Wednesday, 19 August 2020 at 21:24:23 UTC, Mike Brown wrote:
I can see that LDC supports WASM output, and I believe this requires BetterC to be enabled?

Not really but anything beyond -betterC is still kinda diy right now.

So I happened to do port my little tetris game in D to wasm just last week, you can read about it here:
http://dpldocs.info/this-week-in-d/Blog.Posted_2020_08_10.html

And it uses classes! But... I cheated. I did a minimal custom druntime and library port that has just enough to make that little game work. This is a viable approach and can lead to reasonably small compiled binaries, but it is kinda immature.

For a full druntime, the author of spasm <https://github.com/skoppe/spasm/> is working on a port. See his fork here:

https://github.com/skoppe/druntime/tree/wasm

I say "full" but it will most likely leave some things out. Classes, GC (at least of D memory), and other features all should work already if you brave building it yourself, but threads do not work and exceptions are only partially supported. Read more here: https://gist.github.com/skoppe/7617ceba6afd67b2e20c6be4f922725d

That may change in the future as wasm gets more standardized capabilities.

Other libraries, including interop with javascript, are not covered by the druntime goal, but they will probably get easier with this.

I have done some tests, and it appears that classes are supported (LDC 1.22.0)? Is it possible to get an update on what is and still isn't supported in BetterC?

How did you compile it? You can definitely make classes work but as far as I knew it didn't "just work" but maybe that changed with the recent release.

After a stable experience, so if you can also let me know if these features are beta etc too?

but yeah stability is probably a ways out still. Sebastiaan has been busy lately so his druntime work is on pause and mine was just one weekend so I'd have something to show off on the blog; I have no concrete plans of continuing right now.

Good chance we'll get it all working eventually, but I wouldn't expect even beta stability - aside from the diy betterC stuff - any time soon. Maybe beta quality by the end of the year. Maybe.

Reply via email to