TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

An Urgent Notice from AssemblyScript

76 pointsby iMuzzalmost 4 years ago

11 comments

ReactiveJellyalmost 4 years ago
&gt; On August 3rd, the WebAssembly CG will poll on whether JavaScript string semantics&#x2F;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.<p>&gt; If the poll passes, which is likely, AssemblyScript will be severely impacted as the tools it has developed must be deprecated due to unresolvable correctness and security problems the decision imposes upon languages utilizing JavaScript-like 16-bit string semantics and its users.<p>So, the problem is that AssemblyScript wants to keep using UTF-16? I&#x27;m not sure I understand.<p>Is AssemblyScript the thing that lets you hand-write WebAsm?
评论 #27946774 未加载
评论 #27946656 未加载
syrusakbaryalmost 4 years ago
I&#x27;m not going to enter the discussion regarding UTF-8 vs WTF-16 for representing strings, as I lack the context to determine which one is the right approach if everything has to fit the same model. However, I think an approach that allows multiple serialization&#x2F;deserialization mechanisms depending on the host&#x2F;guest language seems like a nice way to move it forward.<p>If you want to chime in and retrieve more context, here are some relevant issues:<p>* <a href="https:&#x2F;&#x2F;github.com&#x2F;WebAssembly&#x2F;interface-types&#x2F;issues&#x2F;135" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;WebAssembly&#x2F;interface-types&#x2F;issues&#x2F;135</a><p>* <a href="https:&#x2F;&#x2F;github.com&#x2F;WebAssembly&#x2F;interface-types&#x2F;issues&#x2F;136" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;WebAssembly&#x2F;interface-types&#x2F;issues&#x2F;136</a><p>* <a href="https:&#x2F;&#x2F;github.com&#x2F;WebAssembly&#x2F;design&#x2F;issues&#x2F;1419" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;WebAssembly&#x2F;design&#x2F;issues&#x2F;1419</a>
dupedalmost 4 years ago
Can the authors expound on the reasons why they can&#x27;t compile their language&#x27;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.
评论 #27952986 未加载
conrad-wattalmost 4 years ago
Full disclosure, I am an active participant in WebAssembly standardisation, my github is here (<a href="https:&#x2F;&#x2F;github.com&#x2F;conrad-watt" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;conrad-watt</a>). What follows is purely my personal opinion.<p>This announcement is deliberately phrased to scare people who do not have sufficient context. I don&#x27;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.<p>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).<p>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&#x2F;security hazard and have campaigned stridently against it. However sanitising strings in this way is actually a recommended security practice (<a href="https:&#x2F;&#x2F;websec.github.io&#x2F;unicode-security-guide&#x2F;character-transformations&#x2F;" rel="nofollow">https:&#x2F;&#x2F;websec.github.io&#x2F;unicode-security-guide&#x2F;character-tr...</a>), so they haven&#x27;t gained the traction they were hoping for with their objections.<p>The announcement is worded to obscure this point - talking about &quot;JavaScript-like 16-bit string semantics&quot; (i.e. where isolated surrogates are not sanitised) as opposed to merely &quot;UTF-16&quot;, which forbids isolated surrogates by definition, but inviting the conflation of the two.<p>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&#x27;t even affect any currently existing AS code. I interpret the announcement&#x27;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.
评论 #27954400 未加载
评论 #27956459 未加载
qalmakkaalmost 4 years ago
This is an unfortunate consequence of the poor choice of keeping UCS-2 alive as UTF-16 for way too long. The plug in 16 bit encodings should have been pulled a long time ago, but some people were and still are so focused on backwards compatibility that they didn&#x27;t see they were just pushing the issue to another decade. UTF-8 has won, completely. UTF-16 is basically a zombie nobody wants anymore, kept artificially alive by the fear of big 90s frameworks of clean breaks with the past.<p>We must get rid of legacy encodings no matter the cost, I&#x27;m tired of seeing Java and Qt apps wasting millions of CPU cycles mindlessly converting stuff back and forth from UTF-16. It&#x27;s plain madness, and sometimes you just need the courage to destroy everything and start again.
评论 #27948159 未加载
评论 #27948565 未加载
AndrewDuckeralmost 4 years ago
This seems to be the discussion thread related to this.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;WebAssembly&#x2F;interface-types&#x2F;issues&#x2F;13" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;WebAssembly&#x2F;interface-types&#x2F;issues&#x2F;13</a>
评论 #27948837 未加载
felipellrochaalmost 4 years ago
Can someone explain the issue at hand? I&#x27;m not sure I have enough context to understand the problem
评论 #27953060 未加载
TeaVMFanalmost 4 years ago
This seems to also impact Java and TeaVM, see this post:<p><a href="https:&#x2F;&#x2F;groups.google.com&#x2F;g&#x2F;teavm&#x2F;c&#x2F;gpy0JoKYqbU" rel="nofollow">https:&#x2F;&#x2F;groups.google.com&#x2F;g&#x2F;teavm&#x2F;c&#x2F;gpy0JoKYqbU</a>
评论 #27953101 未加载
amlutoalmost 4 years ago
Is there a link to the actual poll or its content?
评论 #27953087 未加载
jalino23almost 4 years ago
this sucks. poor web assemblyscript but i really like the rust way
评论 #27953169 未加载
评论 #27951599 未加载
xvilkaalmost 4 years ago
UTF-16 was always a mistake[1]. Good riddance. Time to get it out of LSP specification[2] as well.<p>[1] <a href="http:&#x2F;&#x2F;utf8everywhere.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;utf8everywhere.org&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;language-server-protocol&#x2F;issues&#x2F;376" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;language-server-protocol&#x2F;issues...</a>
评论 #27947544 未加载
评论 #27949264 未加载