Sunday, May 11, 2025

JS on C++ on WASM on JS on C++ (or Go)

JavaScript started as an "interpreted" programming language embedded in web browser.
It is #1 language by usage, and optimized with JIT and other techniques.
And there are multiple JS engines, some quite small.
Now imagine one such engine converted to WASM and then running inside another JS engine.
All for good reason (security, etc.)

"JS all the way down"

Hako - by Andrew Sampson - ./make

PrimJS (and by extension QuickJS) are written in C/C++; integrating them as-is in your program means you inherit any security issues that might be lingering inside them.

Hako compiles down to WebAssembly, a memory-safe, sandboxed execution environment. This means even though Hako is written in C/C++, programs it is embedded in have an extra layer of protection from any potential memory vulnerabilities.

The saying holds that the world is supported by an infinite stack of increasingly larger turtles



No comments: