News for hackers. Stuff that matters.
Re:Play: Statically typed Forth, compiled to WASM by loa_in_ on Monday November 23, 2020 @09:27AM (#25187032)
Does it compile to threaded forth or does it compile to a blob of lowest level instructions or what?
Re:Play: Statically typed Forth, compiled to WASM by Skinney on Monday November 23, 2020 @09:32AM (#25187086)
It compiles, ahead of time, to low level web assembly.
Re:Play: Statically typed Forth, compiled to WASM by loa_in_ on Monday November 23, 2020 @12:21PM (#25189091)
Do you plan to do threaded forth? It does wonders for runtime word redefinition, which I would look for for a niche project of mine involving some kind of ultra portable cross-platform Forth (WASM is perfect) in a sandboxed environment (because multi-player, WASM perfect as well!)
Re:Play: Statically typed Forth, compiled to WASM by stefano on Monday November 23, 2020 @12:38PM (#25189309)
Having implemented a threaded Forth with WASM, the most annoying problem is that WASM doesn't support jumps to arbitrary memory locations. You can either call functions (and you don't have access to the call stack), jump backward to a previously defined block entry point or jump forward to the end of a previously defined block. Threading then requires a double indirection in the core loop, and you have to use an explicit IP "register" in a global variable.
Re:Play: Statically typed Forth, compiled to WASM by Skinney on Monday November 23, 2020 @12:54PM (#25189487)
I don't plan to. I'm sure word redefinition is nice in certain cases, but it's not something I'm looking for in a pure and immutable language.