I don’t get why people want to use WASM if they don’t plan to run it in a browser.
I mean, I do get it, I’m just not sure it’s the right choice. As far as I understand, people use WASM as a new standard for writing plugins for tools.
WASM is yet another scripting language
Historically, if you wanted to create a pluggable system, you would choose a high level language. For example, neovim uses lua for making neovim do things it doesn’t have baked in. Things like syntax highlighting, lsp integration, and keybinding configuration are all set using lua. You write you own scripts and use existing plugins you find online or even buy.
WASM is a way for people who want to develop in practically any language they choose (given a wasm compiler, of course), and run that in the browser. You can bring your own toolchain, own implementation of data structures and all the benefits of your programming language shipped to the browser.
Shipping your languages runtime is a problem that arose from that. But that’s not for this post
But WASM is a weird scripting language
But for some reason people are taking this new, low level language specification and adding support for system calls. It’s called WASI (short for “WebAssembly System Interface”), and it is used for running WASM code inside a process on an operating system.
But something doesn’t add up to me.
The neovim team seems to be satisfied with lua, and so are many Redis users.
And a lot of ML engineers love python and keep adding it as a scripting language as well.
Don’t use WASI unless you are super successful
My bottom line is that most plugins don’t need the complexity and drawbacks that come with using WASM. The only case that justifies this is the browser, as it is the de-facto operating system for any GUI application. Running a game engine inside a browser makes sense, and is possible with WASM. But inside an IDE? A cli tool? not as much.
Usually, plugins can be written in single js/lua/python file, so why bother with WASM?