Re:WebAssembly from Scratch: From FizzBuzz to DooM
by flohofwoe on Wednesday July 14, 2021 @12:25PM
(#27834886)
This would still require conversion from and to Javascript strings, and doesn't help with any language compiled to WASM that isn't Rust. And it probably wouldn't even help Rust because such a native WASM string type would presumably live outside the WASM heap (because if the string data would be on the WASM heap, there's no need for a native string type).
[ Parent
| on HN ]
Re:WebAssembly from Scratch: From FizzBuzz to DooM
by mamcx on Wednesday July 14, 2021 @02:24PM
(#27836500)
Any complex structure past int/floats requiere conversion. Heck, even floats and ints (for example: oCalm and anybody with more/less bits than JS).
So, given this is a fact, the best course of action is chosen the most safe alternative.
And for everyone else? Well an array of bits ant let the host/callers that are the only that know their own stuff deal with it.
INCLUDING Js.
Re:WebAssembly from Scratch: From FizzBuzz to DooM
by brabel on Thursday July 15, 2021 @02:49AM
(#27842053)
I don't know what you're arguing about. The interface types proposal defines a string like this:
string ≡ (list char)
char is defined to be a Unicode scalar value (i.e., a non-surrogate code point).Basically, this is "the most safe alternative"??!
Re:WebAssembly from Scratch: From FizzBuzz to DooM
by mamcx on Thursday July 15, 2021 @11:23AM
(#27845807)
I was arguing against the idea of "string are implemented differently by different languages, so WHICH one choose?".
A safe one. Your sample is that - except I think is better if is a utf-8 string, but this one works for me too-. What will be worrisome is if is made to be like in C.