Using asynchronous web APIs from WebAssembly
web.dev
web.dev
Instead of just using Flash Editor with CrossBridge, here we are 10 years later doing low level plumbing into a standard that hardly moved past MVP 1.0 after 10 years.
My favourite talk at Web Assembly 2020 Summit was about the possible failure for Web Assembly to gain wide adoption due to tooling constraints and minimal language support.
This year, my favourite talk equates Web Assembly to the Concorde, that eventually was removed out of circulation, not due to the accident, but the running costs that did not justify high performance cross atlantic flying.
So when will WebAssembly move beyond low level plumbing and compiler toolchains that require npm like dependencies to generate a plain .wasm file?
TinyGo and Zig can generate .wasm files out of the box.
Good to know that at least two do so, even though Zig isn't even 1.0 and TinyGo is well tiny Go subset.
All in 2011, 10 years ago!
What did I do? Contribute to native apps taking over.
Unfortunately a lost battle now that ChromeOS has won the Web.
Add to that that Go is only partially supported on WebAssembly.
Of course, it's similarly hard to make the case for WASM, which is similarly incomplete today; however, there appears to be mutual interest from language communities and the WASM team to get support working. Even still, I don't intend to make the case until WASM has a decent track record of supporting those languages. But I have more optimism that WASM will get there than JVM or CLI.
Note also that while "JVM and CLI have support for those languages", their support for Python (and probably JavaScript) is only nominal. You can't reasonably use Jython or IronPython with the rest of the Python ecosystem, but WASM at least has a plausible path forward. I also strongly suspect that support for sandbox execution of the other languages is similarly nominal--if it's technically possible, I'd be surprised if anyone is doing this in practice.
"Why the #wasmsummit Website isn't written in Wasm"
https://www.youtube.com/watch?v=J5Rs9oG3FdI
"Production Ready Server-Side WebAssembly: The Challenging Parts"
It remains to be seen when WebAssembly will have native support for GC languages.
Then in case we are talking about languages like C and C++, IBM i and z/OS have had support for them on their language environments since they exist.
Someone posted a demo to HN the other day of compiling Lucene into a Graal image (that the right terminology?) and making grep on steroids. The sub 100ms startup time was impressive.
"Performance tuning Twitter services with GraalVM and Machine Learning"
https://jeeconf.com/program/performance-tuning-twitter-servi...
Asynchronous programming is a different coding mindset, and async-await provides a convenient hack/workaround/solution to go back to a simple linear execution flow (even if that's just an "illusion"). But this problem had been solved many decades ago on the OS level in UNIX and other multitasking operating systems already (and solved it much better, because async-await is essentially cooperative multitasking, like in Windows 3.x or classic MacOS).
Is sleep really considered simple?
a: Linux only. The main interest of browsers are Windows and Mac as most users are on those platforms.
b: Limited to modern variants of the kernel - this is a greater problem the more features that is needed. Not everyone wants to be or can be a kernel hipster.
True, I've considered describing that feature too, but in the end decided it would be too much deviation for the article that is already fairly large. That integration is very interesting on its own, but solves slightly different set of problems - that is, it can' t be used for bridging regular synchronous APIs like WASI in back-compat manner, but rather requires your entire stack to be built on top of async APIs.
If it is, that's indeed an even better solution, but most likely at least majority of your dependencies just use regular std:: APIs that are sync-only.
Describing those tradeoffs and doing meaningful comparison of two approaches feels like a whole separate blog post :)