Adding support for reference types on wasm

The reference types proposal has been merged for a while and it's a good proposal that will let WASM grow on how it interacts with the host environment and it's an overall reasonable proposal.

But I can only find that wasm-bindgen patches the code and some, other, mentions on it. It seems that there is an RFC that's been merged for extern types, but I don't see any reference that let's you use it as a way to use the externref type on WASM

I been wanting to use WASM as plugins and full support of it's features is something that would be nice tbh.


This will be quite hard. The problem is that references cannot be stored in wasm's memory, but the way LLVM works, everything is stored in memory, and then there are some optimizations that pull certain variables out of memory.

It looks like some people are working on this for C; the same problem will also come up for Rust (on top of whatever we have to do in the surface language to make this work).