Re:Grain: WebAssembly-First Programming Language
by pjmlp on Friday May 07, 2021 @01:42AM
(#27072599)
My x86_64 and ARM CPUs were also designed to able to run languages like C and C++ (and Rust) efficiently, and so does not have built in garbage collection.
Re:Grain: WebAssembly-First Programming Language
by Yoric on Friday May 07, 2021 @02:16AM
(#27072833)
And Rust runs very well on them :)
Re:Grain: WebAssembly-First Programming Language
by bayesian_horse on Friday May 07, 2021 @05:01AM
(#27073885)
The burden of entry to learn Rust seems higher than with Grain. And Rust does not have webassembly-centric language features.
C/C++ contains a lot of baggage from other platforms. And has a steeper learning curve. Interoperability with WASM and Javascript is even worse.
Re:Grain: WebAssembly-First Programming Language
by azakai on Friday May 07, 2021 @12:43PM
(#27077872)
Wasm 1.0 did not include garbage collection, but there is a lot of effort right now by many people to add it (that is what I work on myself currently).
Once wasm has GC, languages like Grain will be able to save a lot on code size, and have some advantages over the "first set" of wasm languages (C/C++/Rust/Zig/etc., all using linear memory), like smaller sizes, less memory fragmentation, and properly collecting cycles with JS.
In addition, WebAssembly was designed to be able to run languages like C and C++ (and Rust) efficiently, and so does not have built in garbage collection.
Thus a language that wants to be WebAssembly first, is either going to have to bring in a garbage collector, have safety with something very similar to Rust's borrow checker (in that case, it would be similar complexity to Rust), or else put the burden on the programmer for safety like C and C++ (in that case, what is the advantage over them).