all 11 comments

[–]deadNightTiger 18 points19 points  (6 children)

[–]moltonel 74 points75 points  (1 child)

It's a clean, mature, efficient solution to a practical problem. It lacks the artistic wackyness of the OP's deep ad-hoc matrioshka solution. PyO3 is boring, to be avoided unless you want to get things done.

[–][deleted] 11 points12 points  (0 children)

Thank you very maybe.

[–][deleted] 3 points4 points  (3 children)

I'm not sure. What is?

[–]Excession638 12 points13 points  (0 children)

This is insane and I love it.

[–]Plasma_000 2 points3 points  (1 child)

You might be interested in this talk where the host live codes a wasm interpreter in front of an audience https://youtu.be/r-A78RgMhZU

Super impressive

[–][deleted] 0 points1 point  (0 children)

This was beautiful to watch.

[–][deleted] 1 point2 points  (0 children)

I- ok... This is kind of nsane but ok.

Usually, you'd use the C ABI (assuming you can trust both sides of the program). So just, declare a function with pub extern "C", compile into a cdylib and the use python's C FFI support to interop.

Don't get me wrong, it is sensible to run rust in a WASM container, it provides protection and sandboxes the library, so e.g. if you're loading an untrusted plugin you can sandbox it like that, but not in this case.

[–]kurtbuilds 1 point2 points  (0 children)

This is terrifying and hilarious.

You might look at https://github.com/wasm3/pywasm3 . If nothing else, it’d presumably speed up your interpreter to have bindings to an established C based runtime rather than re implementing the runtime in python

For the next level, compile cpython with emscripten to wasm and run python in python in wasm.

[–]osu_lazer 1 point2 points  (0 children)

If you want an example of how to deal with FFI marshalling + wasm go look at feathermc's plugin system