Top WebAssembly Languages
WebAssembly (Wasm) defines a portable binary-code format for executable programs. It can be used to run languages that support WebAssembly in the browser. Thus, you are no longer restricted to only use JavaScript in the browser. In this article, I want to show you which programming languages currently support WebAssembly.
C#
In the .Net area, Blazor is currently the product from Microsoft that offers interoperability between C# and JavaScript using WebAssembly. You can write frontend and backend applications only in C#. The frontend part runs on WebAssembly in the browser.
https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor
AssemblyScript
AssemblyScript is similar to TypeScript but compiles down to WebAssembly instead of JavaScript. Thus, for computation-heavy logic like image manipulation you could use AssemblyScript since the performance is better than similar TypeScript code.
https://www.assemblyscript.org
C / C++
Emscripten is a compiler that compiles C/C++ code into WebAssembly. It has been one of the first compilers to WebAssembly on the market.
COBOL
COBOL is a business programming language that is still used in many legacy mainframe applications. The Cobweb project compiles COBOL via C to WebAssembly, making a wider use of this eminent language possible.
https://github.com/cloudflare/cobweb
D
The designers of the D programming languages wanted to make a "better C++". It is mostly used in system level programming. The compiler has an option to output to WebAssembly.
Faust
Faust is a functional programming language for sound synthesis and audio processing. It also supports WebAssembly.
Go
Go is a statically compiled programming language with garbage collection and concurrency in mind. It supports WebAssembly.
Pascal
Pascal is a procedural programming language designed by Niklaus Wirth. The Free Pascal compiler also has WebAssembly as a compilation target.
PHP
PHP is a general purpose scripting language targeting web development. Currently, there is an effort to run PHP on WebAssembly. It is called "Wasmer PHP" and is hosted on GitHub.
https://github.com/wasmerio/wasmer-php
Python
Python is a high level, very popular general purpose programming language. The Pyodide distribution targets Python for the browser and Node using WebAssembly.
https://github.com/pyodide/pyodide
Rust
Rust is a multi-paradigm, general purpose programming language. Rust enforces memory safety and is popular for systems programming. Rust supports WebAssembly.
Swift
Swift is a compiled general purpose programming language developed by Apple. Using the SwiftWasm project you can compile Swift to WebAssembly.
Conclusion
As you could see from the list above, there exist currently a multitude of programming languages that support WebAssembly. Thus, you are not stuck with only JavaScript on the browser but can use the language most appropriate for the task. With time, support for WebAssembly in programming languages probably will only grow larger.
References
-
WebAssembly.org: https://webassembly.org
-
Awesome WASM Langs: https://github.com/appcypher/awesome-wasm-langs
-
Cover image Photo by Philip Oroni on Unsplash.
Published
6 Nov 2022