Ported js13k game underrun to D targeting webassembly

Sebastiaan Koppe mail at skoppe.eu
Sun Nov 18 20:07:55 UTC 2018


On Sunday, 18 November 2018 at 19:51:06 UTC, Steven Schveighoffer 
wrote:
> Really cool. I didn't play the original, but I found this 
> reasonably straightforward.
>
> I love this this webassembly stuff, I think it's a fantastic 
> demonstration, and test for the power of D.

Thanks, I think so too. Although there are definitely some 
hurdles to overcome.

> A system to do closures by hand should be doable with templates 
> I would think. Do you have a quick example?

For example 
https://github.com/skoppe/spasm/blob/master/example/underrun/source/game/terminal.d#L259
The whole Handler struct is just to call `terminal_run_story` 
after `terminal_write_text` completes.

One thing that bugs me is that anything that allocates on the GC 
- like the closures here - can't be hooked into to call a custom 
allocator. That includes things like std.array.Appender, AA's, 
etc.


More information about the Digitalmars-d-announce mailing list