skoppe / spasm

Write single page applications in D that compile to webassembly
MIT License
218 stars 17 forks source link

Some suggestions (sorry, no other place to post this) #56

Open dedupely opened 3 years ago

dedupely commented 3 years ago

Hi all! This is a really exciting project. The possibility of using Dlang on the client side blows my mind.

I'd like to make a few questions/suggestions and maybe can help contribute:

skoppe commented 3 years ago

Thanks man. Very much appreciated.

I consider this project mainly an experiment. Out of it came the webidl bindings, as well as my more recent almost-finished efforts to port druntime to webassembly.

The structs in spasm are cute but have shown to have obvious drawbacks. At work I developed a DSL and a compile-time parser. It is a lot easier to work with. I do plan to take that experience and write a spasm v2, but time is limited.

I don't see any limits. The webidl bindings allow you to call any JS api, and there is an unfinished TypeScript bindings generator that allows you to call TS libraries. Most of that is spending a good week or two of getting that finished.

I see little need of a discussion board. I currently have plenty of ideas but no time to execute on them.

dedupely commented 3 years ago

My goal for my project is for us to be 100% Dlang server and client side (share structs, types, non-server libraries, etc). With the exception of glue code, build scripts and other things that might be dependent on Nodejs and Javascript.

Wait...what? You almost have a port for druntime? This means we could use vibe.d's helper libraries like Json, std libs, etc? What about the GC and threads? Do those have support by wasm? Not sure how you do this, but that's pretty ingenious.

One idea I like a lot is to have compiled client side templates that can be used in a virtual dom. Would prevent a lot of sloppy mistakes made in these JS vue.js type libs that make it hard to trust what you write in the template. I'd like to do something similar to diet but without pug (rather just regular html).

skoppe commented 3 years ago

Wait...what? You almost have a port for druntime? This means we could use vibe.d's helper libraries like Json, std libs, etc? What about the GC and threads? Do those have support by wasm? Not sure how you do this, but that's pretty ingenious.

Yep, almost there. Threads and Fibers won't be supported for now, but the GC is. There might be some weird edge cases, but I am almost running druntime/phobos unittests in the browser :)

This was the forum post announcing my proposal https://forum.dlang.org/thread/jggmwuavbkxarzhpvtto@forum.dlang.org?page=1

dedupely commented 3 years ago

Ok, that's pretty out there. I've been waiting for that for a long time. The betterC+no allocations didn't work well for me the first time around.

Quick question, if threads are not part of it that means async code isn't a possibility at first right?

Either way, I'm pretty excited about druntime being in there. I have some fun things to do with that.