It is interesting to see another language target WebAssembly especially one like Racket. The fact that it compiles to a subset of the language limits its utility right now. I think it is a neat proof of concept but it needs full language support.
I read the WASM spec and became somewhat of an expert in it for the purpose of eventually designing a low-level language specifically for wasm, to be the most efficient and lowest-level language you could possibly have for wasm, and then gradually add high level concepts into it to make it more convenient. Kind of like building C on top of asm, and then gradually evolving it into C++. That project never came about though due to lack of community interest and time on my part, but I like seeing languages that take a fresh look at how to integrate with wasm using novel techniques to aim for maximal efficiency.
Racket is a huge language, so be patient wrt features.
To keep motivation high I decided to implement a subset that
can be used to built practical applications - and then extend
the supported features from there. Hopefully, this strategy
will also lead to some early adopters that can help me
prioritize which features to add.
Some features are simply "more of the same".
In this category falls more types of hash tables.
Supporting bignums are also a matter of just doing it.
Other features require more work. I have already done
some work on implementing modules in terms of linklets.
When linklets/modules work, we can reuse the existing
implementation of regular expressions.
Adding continuation marks and delimited continuations
require adding a CPS-pass. This is certainly doable.
Postponing it has been great though. Having a direct style
compiler means the generated code follows the structure
in the input source code. And that makes debugging easier.
Now that bugs have become rarer, it makes sense to look at CPS.
People into this sort of stuff might be interested to know that s7 Scheme also runs really well in WASM. It's 100% ansi C and uses its own GC, so getting it compiled and running in WASM is very simple. I use it in both my audio project (Scheme for Max, an s7 interpreter in Max/MSP) and in a browser based set of music practice tools I am working on as a solopreneur. It's fantastic to be able to write the music theory engine in Scheme instead of JS.
I really hope the racket effort gains traction too! Excited to see this. In comparison, s7 is much more minimal. Though this also means the FFI is dead simple too, so extending it and bridging to js functions is much easier, and everything in s7 is available now in WASM - CL macros, keywords, hashtables, first class environments, continuations, etc
9 comments
[ 2.9 ms ] story [ 28.2 ms ] threadOf course both projects have the same maintainer if I recall, Jens Axel Søgaard is a rockstar :)
It's still early days for the WebRacket project.
Racket is a huge language, so be patient wrt features.
To keep motivation high I decided to implement a subset that can be used to built practical applications - and then extend the supported features from there. Hopefully, this strategy will also lead to some early adopters that can help me prioritize which features to add.
Some features are simply "more of the same". In this category falls more types of hash tables. Supporting bignums are also a matter of just doing it.
Other features require more work. I have already done some work on implementing modules in terms of linklets. When linklets/modules work, we can reuse the existing implementation of regular expressions.
Adding continuation marks and delimited continuations require adding a CPS-pass. This is certainly doable. Postponing it has been great though. Having a direct style compiler means the generated code follows the structure in the input source code. And that makes debugging easier. Now that bugs have become rarer, it makes sense to look at CPS.
Enjoy.
/Jens Axel
An example page (not mine) of it running in the browser is here: https://actondev.github.io/s7-playground/
I really hope the racket effort gains traction too! Excited to see this. In comparison, s7 is much more minimal. Though this also means the FFI is dead simple too, so extending it and bridging to js functions is much easier, and everything in s7 is available now in WASM - CL macros, keywords, hashtables, first class environments, continuations, etc