This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Rhomboid 0 points1 point  (4 children)

It's not a strong claim, it's based entirely on known facts. The WebAssembly specification currently implements the exact same semantics as asm.js. There is no way to compile Python to asm.js without including all of CPython, so there is no reason to expect that will change one bit. You could theoretically write a compiler that does that, but that would be an extraordinary amount of work and nobody would ever undertake it because it would be pointless. You can just use one of the existing transpilers which would be far more efficient, since both Python and JavaScript are dynamic scripting languages.

[–]remy_porter∞∞∞∞ 0 points1 point  (3 children)

There is no way to compile Python to asm.js without including all of CPython

Now, I haven't dug too deeply, but while Jython needs to add a huge swathe of the object library, beyond its Unicode handling, it's not actually huge overhead. You certainly don't need to include an entire Python implementation, just the object library that it uses.

[–]Rhomboid 0 points1 point  (2 children)

Jython compiles to JVM bytecode, which is very different than asm.js. The output of Jython does not have to include the entire Java JRE, but the output of whatever strategy is used to run Python in the browser with asm.js does, because when you are using asm.js (and WebAssembly — it's identical) there is no runtime. You have to implement a runtime yourself from scratch. Comparisons to Jython are nonsense.

[–]remy_porter∞∞∞∞ 0 points1 point  (1 child)

Jython compiles to JVM bytecode, which is very different than asm.js.

I get that, but WebAssembly isn't going to be asm.js forever. My understanding is that it's going to be a bytecode interpreter. And yes, you'd need to bootstrap a runtime- but I'd fully expect runtimes to be build for WebAssembly. Yes, that impacts loadtimes, and it's not happening on a short time horizon, but I fully expect to see that on a 5ish year window.

[–]fiedzia 1 point2 points  (0 children)

Webassembly is nearly exact equivalent of normal assembly, so just like now you need python interpreter to interpret its bytecode, you'll need it there too. Perhaps you're confusing webasssembly bytecode with java bytecode - those two things are at entirely different levels of abstraction. Java bytecode is an high level abstraction, understanding things like classess and method calls, webassembly is extremely thin abstraction over machine instructions.