Rust doesn't have
struct(gc), and, considering
rustc primarily targets LLVM bitcode, can we say Rust will never be able to fully take advantage of WebAssembly reference types?
As I understand WebAssembly reference types are garbage-collected. Or they're optionally garbage-collected, if I'm mistaking. More info:
With reference types, a WebAssembly runtime can handle references to complex host objects (e.g. DOM nodes, or file handles) instead of being limited to integer and floating-point values.
In wasm reference types are opaque values which you can't do anything with other than passing it around. Rust itself not having GC support is not an issue for supporting reference types. The reason we don't support it right now is because reference types can't be stored in the linear memory like regular values. Instead they have to be stored in a side table. While this should be doable, it is non-trivial to handle, especially with respect to allocating table indexes and LLVM doesn't have any support for it, which is necessary before rust can support it.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.