Hacker News new | past | comments | ask | show | jobs | submit login

Like always, browsers are a funny ecosystem and very unpredictable. In all this time I thought that I could see a rise in the adoption of C and Rust libs by the community through WASM but now instead we are building around AssemblyScript. Touche.



I've spent a good amount of time this last year playing around with WASM options in anticipation of it being a major runtime environment for cloud computing.

Rust has the most developed ecosystem but the best experience I've had otherwise was with Zig. It's reasonably easy to write and can produce excellent final wasm size. The only problem is that the compiler is currently exporting every public symbol in the standard library but when I hacked up the compiler to only export a hard coded list of symbols I got ~150 bytes for add (the WASM hello world) and easily sub 1k for the type of modules the post is discussing.


Do you have a fork of the compiler online?


No and it's not useful. It's literally just editing `src/link/Wasm.zig` and changing the `--export-all` line to `--export=addInc` (to use the zig wasm example's naming) and copy/pasting the line if I wanted to export more stuff. The compile invocation is:

    zig build-lib add.zig -O ReleaseSmall -target wasm32-freestanding -static
You can debug the linker invocation with `--verbose-link` on the end of that.

The issue tracking the problem is: https://github.com/ziglang/zig/issues/7133


We just have to compile Rust and C to AssemblyScript, à la asm.js, and come full circle (again).


It's interesting that this seems on one hand "unpredictable" while also being logical. If a company has employees familiar with TypeScript (or even JS) and they have to make a choice between yet another flavor of that or a new language like C/Rust... well the choice is understandable. Once again the path of least resistance to a new web technology ended up being JavaScript - it just wasn't immediately obvious when WASM first emerged.


A JavaScript SuperSet becoming the de facto standard of writing for WASM - I think one can file this under „worse is better“.


JavaScript SubSuperSet


I know I'm deliberately misinterpreting you, but

> a new language like C

is a funny thought ^_^


Yes, funny ecosystem and unpredictable because smart people contribute innovative and interesting things. This is the best feature of an open, truly shared ecosystem. Everyone owns it and feel safe contributing to it. The web rules!


I wish I could share your enthusiasm. Good on you. To me the web of today is an ever-expanding ball of shit being rolled in different directions by giant corporations. I agree it's fun to work with, but it isn't healthy.


I agree with your take on the web today. I am trying to do my part to promote the things outside that bubble. I thought this was a good place to do that :)


I'm keen on Kotlin Multiplatform. Seems like a pipe dream that might have legs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: