3 ms·
Part of the security model of WASM is that guest values are opaque to the host and host values are opaque to the guest. You can get a lot of mileage out of (ref
by davexunit 3y ago
Part of the security model of WASM is that guest values are opaque to the host and host values are opaque to the guest. You can get a lot of mileage out of (ref extern) right now. Like if you import document.createTextNode you know the extern ref you get back is a text node and you can wrap the extern up as such in your WASM program. I have wrapped a subset of the DOM and Canvas APIs and made several small programs like a classic todo list example and a small retro video game rendered to canvas. I've been able to create elements, assign event handlers, use setTimeout/requestAnimationFrame, etc. all from within WASM. So while additional proposals could add more useful reference types (such as (ref string) from the stringref proposal) you can already do a lot with the types that are there now that reference types + GC are part of core WASM.