Which programming language for WebAssembly?
WebAssembly solves a lot of cross-device compatibility issues, it's like a more universal Java. But also more complex to implement because of the security measures that have been integrated into it. A language for generating wasm code may be more suitable than another depending on the type of application considered: local full wasm, local with Node.js, or on the Web.
The end of the tunnel with WebAssembly
For the functions which must access the filesystem, we must also include WASI, a runtime dedicated to WebAssembly and which replaces libc.
The command to compile a library looks like this:
emcc hello.c -Oz -s WASM=1 -s SIDE_MODULE=1 -o hello.wasm
C and C ++ languages are not the best suited for use with node.js.
It is a new language from Mozilla, one of the main players in the development of WebAssembly, so it compiles well in wasm, but obviously does not allow reuse of old programs.
Just like Rust, Julia uses the LLVM platform to create executable code, and therefore generates LLVM bitcode which easily converts to wasm.
See at the Julia-Wasm for instructions of use.
However, its runtime integrates memory management and a garbage collector. The language supports the String type and dynamic arrays.
We generate a wasm file with a simple command:
C# (With Blazor)
Another language of the LLVM platform. The SwiftWasm site explains how to create a wasm program with a single instruction:
swiftc -target wasm32-unknown-wasi hello.swift -o hello.wasm
You need to include the WASI runtime. SwiftWasm does not work on Windows, but you can create wasm programs on Linux and use them in the browser on all systems.
A way to generate wasm by C++ without programming in C++. The scriptol language with its clear and simple syntax compiles in C++ which is then compiled in wasm et may be run directly also with wasmer.