4 ms·
I don't understand WASM, but I read that a big draw of WASM is it's ability to provide portability to any language. This would mean Python libraries that depend
by Capricorn2481 2y ago
I don't understand WASM, but I read that a big draw of WASM is it's ability to provide portability to any language. This would mean Python libraries that depend on an unpopular C library (which could be lost to time) could instead be a single WASM blob.
Assuming equivalent performance, which I understand might not be the case, is there merit to this idea? Or is there nothing new WASM provides?
- tyingq 2y agoThe closest way to visualize it is probably how cloudflare offers something kind of like a container (if you squint) via it's workers product. https://blog.cloudflare.com/announcing-wasi-on-workers/ https://blog.cloudflare.com/announcing-wasi-on-workers/ I assume the merit for cloudflare is lower overhead cost per worker than if they had done something more like AWS lambda. Explained better than I can, here: https://developers.cloudflare.com/workers/reference/how-workers-works/ https://developers.cloudflare.com/workers/reference/how-work... It does currently present a lot of restrictions as compared to what you could do in a container. But it's good enough to run lots of real world stuff today.
- pjmlp 2y agoEven closer WebLogic, WebSphere, JBoss, Glassfish in 2002, but now instead of a EAR file, it is a WASM one.
- gedw99 2y agoI run my golang on car workers. It does not work with wasi. I just use a simple driver: https://github.com/syumai/workers https://github.com/syumai/workers Wasi is so painful that I just write all my golang using stdio and have a shim per runtime. Web browser, Cloudflare, server ( with wazero ). The new go:wasmexport might be useful in go 1.24 but I highly doubt by it.
- hardwaresofton 2y ago> I don't understand WASM, but I read that a big draw of WASM is it's ability to provide portability to any language. This would mean Python libraries that depend on an unpopular C library (which could be lost to time) could instead be a single WASM blob. Yes, this is a key value of WebAssembly compared to other approaches, it is a relatively (compared to a container or a full blown VM) lightweight way to package and distribute functionality from other languages, with high performance and fast startup. The artifact is minimal (like a static/dynamic library, depending on how much you've included), and if your language has a way to run WASM, you have a way to tap into that specialized computation.
- pjmlp 2y agoIronPython alongside C++/CLI on the CLR, everything compiled down to MSIL bytecodes.
- Capricorn2481 2y agoI could be wrong, but I can't find anything about how to include your C dependencies with IronPython when you compile. Instead I see that IronPython has limited compatibility with the Python ecosystem because of Python libraries using C. Contrasted with WASM where you can write in any language and bring the ecosystem with you, since it all compiles down.
- hardwaresofton 2y agoFully agree with your point here, but wanted to point out that including C dependencies is actually one of the biggest reasons why Python support is hard for WebAssembly too. Bolstering your point -- smart-and-hardworking people are working on this, which results in: https://github.com/bytecodealliance/componentize-py/ https://github.com/bytecodealliance/componentize-py/ which inspired https://github.com/WebAssembly/component-model/blob/main/design/mvp/examples/SharedEverythingDynamicLinking.md https://github.com/WebAssembly/component-model/blob/main/des... with some hard work done to make things work: https://github.com/dicej/wasi-wheels https://github.com/dicej/wasi-wheels It's a fun ecosystem -- the challenge is huge but the work being done is really fundamentally clean/high quality, and the solutions are novel and useful/powerful.
- pjmlp 2y agoYou compile them with C++/CLI, which is why I referred to it, no different than using emscripten.
- zfg 2y agoApplication plugins could also be wasm. That lets plugin authors write in any language they want and have their plugin work. That's the idea behind the Extism framework: https://extism.org/ https://extism.org/ uBlock Origin uses WebAssembly in Firefox for better performance: https://github.com/gorhill/uBlock/wiki/uBlock-Origin-works-best-on-Firefox https://github.com/gorhill/uBlock/wiki/uBlock-Origin-works-b...
- pjmlp 2y agoBasically yet another bytecode based runtime, but being sold as if it is the very first of its kind, despite prior history.
- afiori 2y agoI think that looking at it in terms of Embeddability is more useful compared to portability. In the sense that compiling C to any language is easily done without too many problems, what wasm allow is to have a secure and performant interface with that language. For example IIRC one of the first inclusions of wasm was to sandbox many of the various codecs that had regular security vulnerabilities, in this Wasm is neither the first nor the only approach, but with a combination of hype and simplicity it is having good success. as in https://arxiv.org/abs/1912.02285 https://arxiv.org/abs/1912.02285