Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is one of those ideas that makes so much sense that you'd ask why didn't it catch on before: WASM as a modules for all sorts of platforms

It could become a competitor for a lot of existing technologies. Some examples:

* embedded script languages (e.g.: Python in Blender and Gimp, Lua in games, VBScript in MS applications).

* add-on modules (e.g. COM on Microsoft platforms or COM-like for non-MS)

* finally, a run-anywhere platform? (what the JVM and .Net always wanted to be)



> finally, a run-anywhere platform? (what the JVM and .Net always wanted to be)

WebAssembly doesn’t include a system interface, i.e., any way to interact with the outside world, so it isn’t an apples-to-apples comparison.

WASI seems like it’s coming along nicely, but it has nowhere near the feature set of the JRE or .NET. Anything that even approaches that level of capability is going to run into the exact same bloat and platform compatibility problems that those runtimes did.


> WebAssembly doesn’t include a system interface, i.e., any way to interact with the outside world

This can be quite an improvement for running add-ons from some arbitrary source.

While, of course, an way to access defined resources is needed.


Sure, but your add-ons will need access to some of the world, which right now requires giving them access to all of WASI, as far as I know. There’s no permissions model. That’s worse than the JVM.

(It seems like they want to implement one… someday. It’s vague: https://github.com/bytecodealliance/wasmtime/blob/main/docs/...)


A game which uses WASM plugins for modding would define its own 'system interface', basically an extremely restricted API to only access moddable game features but not allow access to any 'operating system services'.

It's very similar to how games would use a restricted subset of Lua which can only call into scripting APIs provided by the game, but not use random Lua stdlib features (like reading/writing files).


> WebAssembly doesn’t include a system interface, i.e., any way to interact with the outside world

I believe that's WASI, which builds on top of the base wasm spec: https://wasi.dev/interfaces#presentation

e.g. the WASI 0.2 spec here mentions clocks, filesystem access, creating sockets, etc.

Lua is architected the same way - As host, you create a Lua VM with no I/O, and then the host decides which I/O interfaces the VM can or cannot see.

JRE and .NET are probably built the same way internally. The reason wasm is hyped more than VMs with a decade of momentum behind them is that wasm is lower-level, it isn't tied to any particular GC model, and there's already backends for popular low-level languages like C, C++, Rust, and Go to compile into wasm modules.


Like this?

"More than 20 programming tools vendors offer some 26 programming languages — including C++, Perl, Python, Java, COBOL, RPG and Haskell — on .NET."

From https://news.microsoft.com/source/2001/10/22/massive-industr...

"The Amsterdam Compiler Kit (ACK) is a retargetable compiler suite and toolchain written by Andrew Tanenbaum and Ceriel Jacobs, since 2005 maintained by David Given.[1] It has frontends for the following programming languages: C, Pascal, Modula-2, Occam, and BASIC."

"Maximum portability is achieved by using an intermediate language using bytecode, called EM. Each language front-end produces EM object files, which are then processed through several generic optimisers before being translated by a back-end into native machine code. "

From https://en.wikipedia.org/wiki/Amsterdam_Compiler_Kit

"When IBM i was first released as OS/400, it was split into two layers, the hardware-dependent System Licensed Internal Code (SLIC)[15][1] and the hardware-independent Extended Control Program Facility (XPF).[16][8][33][34] These are divided by a hardware abstraction layer called the Technology Independent Machine Interface (TIMI). Later versions of the operating system gained additional layers, including an AIX compatibility layer named Portable Application Solutions Environment (originally known as the Private Address Space Environment),[5][35] and the Advanced 36 Machine environment which ran System/36 SSP applications in emulation.[1]"

From https://en.wikipedia.org/wiki/IBM_i#Technology_Independent_M...

Other examples can be retrieved from annals of history.


I wonder why none of this caught on


Yes, I discussed WASI in my comment. It has maybe 1% of the feature set of the JRE/.NET core libraries, and I think that’s a generous estimate.


> WebAssembly doesn’t include a system interface, i.e., any way to interact with the outside world, so it isn’t an apples-to-apples comparison.

For a plugin system this sort of isolation from the outside world is pretty much a hard requirement. You don't want random plugins to read/write/delete random files in your filesystem.


> JRE or .NET. Anything that even approaches that level of capability is going to run into the exact same bloat and platform compatibility problems

Challenge has been accepted. Let's see.


Because this idea has been done multiple times throughout the years with different kinds of bytecodes and VMs, since UNCOL in 1958, the WebAssembly folks just pretend they are always the first at something.


Java applets say hello! Maybe they were just before their time, hobbled by slow computers, hard disks, and Internet connections.


The tooling doesn't seem to be there to run C++ / Rust / Go / whatever efficiently on a JVM, too


It is there for C++ on the CLR, or IBM i, or TenDRA, or ...


Indeed, CloudFlare Workers does this. Would love to see more.


Yep, pretty sure that is what companies like Dylibso are working towards, making software into modules underpinned by plugins that are powered by WASM:

https://dylibso.com/


wasm is the perfect abstraction to build a -modular- and pluggable codebase (say grpc/proto as contracts) so you can just swap any part of it as long as the wasm module abides to such contract.

I keep going more and more to it when I try to design systems, in my mind at least, hoping I can put some to use


Wasm "web components" should be helpful here.


Extism is a plug-in framework based on WebAssembly:

https://extism.org/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: