Remix.run Logo
lenkite 6 days ago

Calling it an over-engineered mess when it solves a complex problem through well-defined specification and semantics is very poor posturing. The WASM specs are actually FAR easier to read and grok than most of the legacy WebAPI's! Many of these problems are already being solved.

For strings, the rules are:

    The string is encoded as UTF-8.

    The ABI lowers it into a (ptr: u32, len: u32) pair in linear memory.

    The receiving component or adapter then uses the (ptr, len) to read the UTF-8 bytes and convert it back into its own string representation.

Modern languages that already have UTF-8 strings don't need to pay extra costs. Even old languages like Java are moving to UTF-8 now. Compact Java strings are already UTF-8.

No, the JS shim way is the terrible mess that adds a ridiculous amount of overhead and a truck load of hacks to obtain limited performance. Just have a look at the code for wasm-bindgen for the very definition of messy-engineering and awkward workarounds to get things running.