Home | Notifications | New Note | Local | Federated | Search | Logout
Note Detail
mcc@mcc@mastodon.social (2025-06-04 08:47:27)
…because the WASM committee sorta believes nobody ever *writes* the textual form? Nobody writes textual Wasm except people making test cases for compilers, everyone else uses the compilers. Okay, whatever. But this means they'll never fix the rough edges, like how the only way to embed byte data in your textual wasm is as an ascii string. What if you want non-ASCII characters? "\F0\0F\00\00". Inconvenient for my purposes. It is unpleasant to be "nobody", it turns out.
Reply
---Replies---
mcc@mcc@mastodon.social (2025-06-04 08:51:44)
Due to the byte nonsense, and it turning out there's no cross-compatible way to do a "print" statement that works in both WASI and browser WASM, I sought an impractical but effective solution: I wrote a Wasm preprocessor.
https://github.com/mcclure/aoc2024/blob/6f8ca110b931558a42826f8257996e53010e555f/11-01-stones/tools/prep.py
Or rather I wrote a very simple, C-like preprocessor that uses ;; wasm comment indicators instead of #, in 200 lines of python, which I expect I can usefully adapt to other asms someday later. It knows how to do the wasm byte string packing.
---Attachments---
image: https://files.mastodon.social/media_attachments/files/114/622/114/011/359/671/original/c9a725cbf782847f.png