News for hackers. Stuff that matters.
Re:Python 3.11 in the Web Browser by stavros on Saturday March 26, 2022 @06:04PM (#30815778)
I find WASM in general very cool. Is there a way to run a WASM "binary" locally? For example, can I distribute a program as WASM and execute ./mywasmprogram and have it run?

I imagine I need a WASM runtime installed, and to somehow get my shell to recognize that WASM programs should be loaded with it (for lack of a hashbang line), but is that actually doable?

Re:Python 3.11 in the Web Browser by simonw on Saturday March 26, 2022 @06:05PM (#30815783)
Yes, definitely. Wasmer is one way to do that: https://docs.wasmer.io/ecosystem/wasmer/getting-started
Re:Python 3.11 in the Web Browser by teddyh on Saturday March 26, 2022 @06:34PM (#30815970)
Note: There was some discussion of Wasmer here a couple of days ago: https://news.ycombinator.com/item?id=30758651
Re:Python 3.11 in the Web Browser by stavros on Saturday March 26, 2022 @06:06PM (#30815790)
Excellent, thank you! I knew of Wasmer but didn't realize that's what it was. I look forward to the day where we can just distribute one architecture-independent binary.
Re:Python 3.11 in the Web Browser by wffurr on Saturday March 26, 2022 @06:18PM (#30815878)
Like a .jar file?
Re:Python 3.11 in the Web Browser by tormeh on Saturday March 26, 2022 @07:04PM (#30816138)
Yes, but with a much leaner, memory-efficient, and more secure runtime. WASM is kinda "JVM without the Java bits" but that's a good thing. Having the VM provide facilities for GC is not necessary. Go shows that you can embed it in the executable. And Java bytecode is too close to Java code and not close enough to machine code, and so the VM has to provide a full interpreter - also unnecessary.
Re:Python 3.11 in the Web Browser by brnt on Sunday March 27, 2022 @06:20AM (#30819145)
Wasm requires a full JS runtime no? At this point those are no lighter than a full JVM.
Re:Python 3.11 in the Web Browser by callahad on Sunday March 27, 2022 @12:03PM (#30821310)
Nope! Much like Node allows you to run JavaScript without a browser, there are plenty of standalone WebAssembly runtimes which don't need a host JavaScript runtime.
Re:Python 3.11 in the Web Browser by gmatejka on Saturday March 26, 2022 @06:16PM (#30815869)
You can also use node to execute webassembly programs.

You do have to create a js host file, load in your webassembly and then run it with node.

Re:Python 3.11 in the Web Browser by adamredwoods on Sunday March 27, 2022 @03:06AM (#30818350)
The WASI interface even has system file access:

https://nodejs.org/docs/latest-v17.x/api/wasi.html

Re:Python 3.11 in the Web Browser by Klasiaster on Sunday March 27, 2022 @06:32AM (#30819190)
wasmtime, Standalone JIT-style runtime for WebAssembly, using Cranelift: https://github.com/bytecodealliance/wasmtime

wasm3, WebAssembly interpreter: https://github.com/wasm3/wasm3

… and many more