Standards objections
assemblyscript.org
assemblyscript.org
In the context of a web browser having low-level access to the client's filesystem (e.g. fd_write) seems like a bad idea/security problem. However, if you're executing WASM from the perspective of, "I'm running this on my desktop" or "this is a microservice I am running on my server" suddenly low-level filesystem access makes a lot more sense.
It's up to the implementation to add controls around or completely restrict things like filesystem access. There's no reason why such features can't be included in the larger standard of WebAssembly. It's similar to .webm being a subset of the Matroska (.mkv) container format... For the web, specifically the folks that defined .webm (Google) decided that they didn't want or need all the features of Matroska.
It's also clear this person would be extremely unpleasant to collaborate with. So none of this is surprising.
To be honest, that's not the way standards should be done: standards are named this way because they require wide adoption. Until that happens, they are not standards... just technical specifications.
In general I believe there's a great opportunity to create something based on true Web Standards and not proprietary APIs driven by the big corps, that also can run fully server side.
Even Python which adopted the pretty ridiculous internal UCS4 encoding is now carrying around a utf-8 pre-encoded version of strings for crossing boundaries. UTF-8 is just too widespread that many languages can avoid having to support it natively in some form.
Likewise WASM is not the first standard that has opinions about string encodings that are not native to a language. For instance Go and Rust which prefer to use UTF-8 internally have to re-encode on the way to Windows APIs (usually!). Likewise Cocoa/Objective-C traditionally use UCS-2 strings which are quite leaky, yet Swift nowadays uses UTF-8 internally and transcodes.
The question is IMO not really about if someone operates on unicode code points or not, but what encoding strings shared across a WASM bridge should have and coming to one makes sense.
let myString = "...";
let returnedMyString = someFunction(myString); // might or might not cross boundary
if (myString == returnedMyString) {
// sometimes silently false
}
I am having a hard time to understand how so many people prefer this as the outcome of a Web / polyglot / language neutral standard, especially since affected languages cannot change, and the problem is so trivially avoided, say with a boolean flag "this end is WTF-16, it's OK if the other end is as well" (otherwise use well-formed/UTF-8 semantics).For context, I once gave a presentation about the pitfalls: https://www.youtube.com/watch?v=Ri2NMnSQo4o
It's because the idea that languages "cannot change" does not appear to be true. UTF-8 is so widespread now that for languages changing the native string representation towards it has become an interesting proposition. Many modern languages (eg: Go and Rust) already picked UTF-8, others such as Swift changed over to it. Then there are implementations of languages like Python (PyPy) that changed their internal encoding even though that was a widespread assumption that it cannot work.
The web is also not WTF-16, JavaScript is and the web consists of more than just that. WTF-16 to WTF-16 is most likely becoming less and less a thing going forward except for legacy interfaces such as W APIs on Windows and even there it appears that UTF-8 on the codepage level is now strongly recommended.
To give you another example: I'm very interested in using AssemblyScript today to do data processing, but that actually is not all that easy because the data I need to process is in UTF-8. Now to use the string class in AssemblyScript I actually have to do a pointless data conversion to WTF-16 and back.
I would be majorly surprised if JavaScript doesn’t adopt UTF-8 at one point as well.
I expect other languages to make the switch sooner or later.
I do think though that this is not all that interesting for the issue here. WASI needs to pick some format and picking UTF-8 is fine. Roundtripping half broken UTF-16 is something that does not need preserving.
I think enforcing UTF-8 there won’t be much of an issue in practice.