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.

Strings in WebAssembly

70 pointsby dmitabout 5 years ago

6 comments

Benmcdonald__about 5 years ago
The Mozilla developer working on web assembly wrote some good articles on types<p><a href="https:&#x2F;&#x2F;hacks.mozilla.org&#x2F;2019&#x2F;08&#x2F;webassembly-interface-types&#x2F;" rel="nofollow">https:&#x2F;&#x2F;hacks.mozilla.org&#x2F;2019&#x2F;08&#x2F;webassembly-interface-type...</a>
phibzabout 5 years ago
Maybe it was just me but this felt a bit overly pedantic. Understanding the internals of wasm bindgen is important for understanding how rust handles strings in WASM, but I was expecting a higher level discussion of how strings are passed to WASM.
brainsmithabout 5 years ago
Due to the the lack of native strings in WebAssembly different Wasm compilers have different memory layouts and string encodings. For example assemblyscript uses ucs2 for the sake fo compatibility with JavaScript. This obliges to carefully work with memory bounds, string length estimation due to difference in host native and guest string encodings.<p>For the specific goal of working with Strings in rust and assemblyscript I&#x27;ve created this project: <a href="https:&#x2F;&#x2F;github.com&#x2F;onsails&#x2F;wasmer-as" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;onsails&#x2F;wasmer-as</a>.
评论 #22405930 未加载
评论 #22403957 未加载
continuationalabout 5 years ago
To quote the Medium comment from Masklinn:<p>&gt; Actually, humans generally think in terms of graphemes, which may or may not be composed of multiple Unicode code points (irrespective of the normalization form being used).
alexgmcmabout 5 years ago
Medium delenda est.
评论 #22403011 未加载
评论 #22405011 未加载
评论 #22402775 未加载
tyingqabout 5 years ago
Is it unusual for a VM not to have a string (or at least a bytes) type? I have little experience in the space, but it seems clunky. Curious why WASM went this direction.
评论 #22403644 未加载
评论 #22403709 未加载