Hacker News new | ask | show | jobs
by dfabulich 113 days ago
Today, the entire Web API is defined in WebIDL, a specification-only interface-definition language that inherently assumes you have access to JavaScript strings, objects, exceptions, promises, etc. None of those are available in WASM.

WebAssembly Components aren't nearly enough to accomplish what this article offers to accomplish. Even once components are a thing, you'd then have to restandardize the entire Web API in their new IDL, WIT.

The WebIDL specifications have taken decades to standardize. It requires Apple, Mozilla, Google, and Microsoft to agree on everything. Getting all of them to agree to restandardize on a new IDL is not going to happen this decade.

2 comments

The article was too long already to get into this, but it's a good question. Getting browser vendors to standardize a new IDL is a non-starter. My personal preference is to derive WIT/component interfaces from WebIDL, and I've done enough research to believe it's feasible. I'll talk about that more in the future. There are some other options too if that is a dead end.
There can be an automated way of translating WebIDL to wit.

I've actually tried to do that the past and got pretty far. https://github.com/wasi-gfx/webidl2wit

And here's the generated wit https://github.com/mendyberger/brow

Sorry, here's the working link https://github.com/mendyberger/browser.wit