3 ms·
Interesting! Was there anything that you think came out significantly better than if you had written it in, say, C or Rust?
by raphlinus 5y ago
Interesting! Was there anything that you think came out significantly better than if you had written it in, say, C or Rust?
- pacaro 5y agoAlmost the opposite probably, the webassembly text (WAT) format isn't really designed to be used as a human generated language, its almost actively hostile. That being said there is definitely a benefit to writing in any assembly language that it imposes a discipline on the programmer, that is just as true for WAT, whenever you access data you are thinking about where it is stored, how it is loaded etc.
- daliwali 5y agoIf I had to guess, it's because the WebAssembly Text Format is S-Expressions, similar to the target language, Scheme. Also, less tooling involved to build the binary, since the text format is pretty close to the binary format. In practice though, it looks closer to C/ASM. The author even wrote comments in C. This is the first time I've looked at an actual program written in the wasm text format and it's pretty interesting to see how one would actually use it. Very neat.
- pacaro 5y agoI've definitely evolved my "style" as I've worked on it, the earliest code I was thinking in C and writing in WAT (hence the comment style), As I got more familiar I changed how I wrote it (adding the macro layer helped with that)