Hacker News new | ask | show | jobs
by davexunit 97 days ago
I really want stringref to make a comeback.
1 comments

My god yes.

I'm building a new Wasm GC-based language and I'm trying to make as small as binaries as possible to target use cases like a module-per-UI-component, and strings are the biggest hinderance to that. Both for the code size and the slow JS interop.

Yeah it's really frustrating and JS string builtins are not a good fit for me as I do not want to deal with 16-bit code units.
Who killed stringref and why?
It couldn't get past a vote in the Wasm community group to advance from phase 1 to phase 2.

Here's a quote from the "requiem for stringref" article mentioned above:

> 1. WebAssembly is an instruction set, like AArch64 or x86. Strings are too high-level, and should be built on top, for example with (array i8).

> 2. The requirement to support fast WTF-16 code unit access will mean that we are effectively standardizing JavaScript strings.

Can you use WTF-16 for strings in your language?
I have a compiler flag to switch from wtf-8 and wtf-16 so if you compiler for your host you don't have to reencode strings. That means that strings in my language hide their byte representation, don't allow indexed access, and only have code point iterators.