top | item 30021271

(no title)

tester34 | 4 years ago

Is WASM going to replace:

Lua, JS and LLV IRM?

discuss

order

kortex|4 years ago

No, no, and no. The only one remotely close in scope is LLVM-IR, and even then scope is pretty significantly different. LLVM-IR is a general purpose IR for native compilation. Wasm is deliberately small in scope and designed for sandboxing.

Lua and JS are not even binary languages.

Findecanor|4 years ago

WASM is a compiler target. It was designed for fast compilation into native instructions with deterministic effects.

LLVM-IR has been considered, but has never been suitable as a compiler target. Code is targeted for a specific arch even before it becomes translated into LLVM-IR. Undefined behaviour in C is undefined also in LLVM-IR, and a portable compiler target can not have any. It is also changing too much between compiler versions (which is a reason why SPIR moved away from it).

BTW. It seems that in the long-term, the use of LLVM-IR in compilers is going to be replaced with MLIR (Multi-level IR).

BlueTemplar|4 years ago

Isn't it an intermediating language ? Why would it replace them, it's not like a lot of people directly code in assembly when C is available...

cpuguy83|4 years ago

Instead of, as an example, coding a plugin in lua, you code it in whatever you want and compile to wasm (that supports wasm as a compile target). In that sense it would be replacing lua.

_nalply|4 years ago

No. I am not a clairvoyante but I think there will be possibilitites to compile to WASM. LLV IRM is a special case but transcompiling is not unimaginable.