Earlier quoted context omitted.
JavaScript is called the entire "web" now? HTML and CSS work with UTF-8 just fine and the majority of the WWW uses UTF-8 to serve them.
I think you know the poster is taking about programming languages, where the bulk of complexity lies.
An Urgent Notice from AssemblyScript
31–40 of 55 posts
Re: An Urgent Notice from AssemblyScript
#32> On August 3rd, the WebAssembly CG will poll on whether JavaScript string semantics/encoding are out of scope of the Interface Types proposal. This decision will likely be backed by Google (C++), Mozilla (Rust) and the Bytecode Alliance (WASI), who appear to have a common interest to exclusively promote C++, Rust respectively non-Web semantics and concepts in WebAssembly. > If the poll passes, which is likely, Assem…
Yes, it seems they want to use UTF-16 strings. I’m confused why they can’t just switch their (nascent) language to UTF-8, and if so why the alarmist attitude? I didn’t think they were mature enough to claim no breaking changes, for example. I probably prefer we drag the web (and .Net and Java) platforms towards UTF-8, to be honest… but maybe that’s just me.
That's not what the web needs. The web needs WebAssembly to work flawlessly with JavaScript for maximal potential, so the web will be great and not just a performance landmine that native developers will laugh (as much) at.
Re: An Urgent Notice from AssemblyScript
#33Can the authors expound on the reasons why they can't compile their language's string semantics into whatever representation will be used by WASI? Both C++ and Rust support numerous string representations, C++ even more so than Rust.
How does a compiler ensure that when that string is passed to a Rust Wasm module it goes to it in UTF-8 and then when moments later the same string is passed by the same module to JS it goes over as WTF-16?
How will the compiler know where the string is being passed after compilation (at runtime)?
What new syntax would you propose for TypeScript to make it possible to work with all strings types? How would you keep TS/JS developer ergonomics up to par with what currently exists?
If Interface Types we're to consider web as a first class citizen (because Wasm originated as a web feature) then interop between Wasm modules and JS would considered of utmost importance, without making a web language ,(such as AssemblyScript) have to go through great lengths to engineer that aforementioned complication.
Re: An Urgent Notice from AssemblyScript
#34Can someone explain the issue at hand? I'm not sure I have enough context to understand the problem
- an extra performance cost due to format conversion at the boundary,
- as well as negative implications on security and data integrity,
thus making this a loss for the web if Interface Types will not be fully compatible with the web (JavaScript) by default.
Hope that sums it up in one sentence. :)
Re: An Urgent Notice from AssemblyScript
#35Is there a link to the actual poll or its content?
https://github.com/WebAssembly/meetings/blob/main/main/2021/...
Re: An Urgent Notice from AssemblyScript
#36This seems to also impact Java and TeaVM, see this post: https://groups.google.com/g/teavm/c/gpy0JoKYqbU
Re: An Urgent Notice from AssemblyScript
#37this sucks. poor web assemblyscript but i really like the rust way
This influx is the reason why AssemblyScript is now in the top three WebAssembly languages next to C++ and Rust (https://blog.scottlogic.com/2021/06/21/state-of-wasm.html) and should not be taken lightly.
There is a huge opportunity here to build an optimal foundation for these incoming developers, so that they won't be let down.
The influx has only just begun.
Ideally though, interface types would give languages options: the ability to choose which format their boundary will use. Obviously a JS host and a language like AssemblyScript would align on WTF-16, while a Rust Wasm module running on a Rust-powered Wasm runtime like wasmtime could optimally choose UTF-8.
I'm hoping things will be designed with flexibility in mind for this upcoming most-generic runtime feature.
Re: An Urgent Notice from AssemblyScript
#38this sucks. poor web assemblyscript but i really like the rust way
Yea, my first contact with wasm was through AS but I switched to rust soon after, it just doesn't have the same momentum.
In the past year it has gained numerous libraries and bindings, including from Surma from Google. Stay tuned...
Re: An Urgent Notice from AssemblyScript
#39This announcement is deliberately phrased to scare people who do not have sufficient context. I don't know why some AssemblyScript maintainers have decided to act in this extreme way over what is quite a niche issue. The vote that this announcement is sounding the alarm over is _not_ a vote on whether UTF-16 should be supported.
There has been a longstanding debate as part of the Wasm interface types proposal regarding whether UTF-8 should be privileged as a canonical string representation. Recently, we have moved in the direction of supporting both UTF-8 and UTF-16, although a vote to confirm this is still pending (but I personally believe would pass uncontroversially).
However, JavaScript strings are not always well-formed UTF-16 - in particular some validation is deferred for performance reasons, meaning that strings can contain invalid code points called isolated surrogates. Again, the referenced vote is _not_ a vote on whether UTF-16 should be supported, but is in fact a vote on whether we should require that invalid code points should be sanitised when strings are copied across component boundaries. Some AS maintainers have developed a strong opinion that such sanitisation would somehow be a webcompat/security hazard and have campaigned stridently against it. However sanitising strings in this way is actually a recommended security practice (https://websec.github.io/unicode-security-guide/character-tr...), so they haven't gained the traction they were hoping for with their objections.
The announcement is worded to obscure this point - talking about "JavaScript-like 16-bit string semantics" (i.e. where isolated surrogates are not sanitised) as opposed to merely "UTF-16", which forbids isolated surrogates by definition, but inviting the conflation of the two.
AS does not need to radically alter its string representation - if we were were to support UTF-16 with sanitisation, they could simply document that their potentially invalid UTF-16 strings will be sanitised when passed between components. Note that the component model is actually still being specified, so this design choice doesn't even affect any currently existing AS code. I interpret the announcement's threat of radical change as some maintainers holding AS hostage over the (again, very niche) string sanitisation issue, which is frankly pretty poor behaviour.
Re: An Urgent Notice from AssemblyScript
#40this sucks. poor web assemblyscript but i really like the rust way
It is fair to like Rust, but there is nonetheless an influx of web developers who already know JavaScript and TypeScript moving to AssemblyScript to (finally) experience what Wasm is all about. They don't want to move to other languages. I believe their experience should be highly valued, and as optimal as possible. This influx is the reason why AssemblyScript is now in the top three WebAssembly languages next to C++…