> ..here is the summary of the additions in version 2.0 of the language:
Vector instructions: With a massive 236 new instructions — more than the total number Wasm had before — it now supports 128-bit wide SIMD (single instruction, multiple data) functionality of contemporary CPUs, like Intel’s SSE or ARM’s SVE. This helps speeding up certain classes of compute-intense applications like audio/video codecs, machine learning, and some cryptography.
Bulk memory instructions: A set of new instructions allows faster copying and initialization of regions of memory or ranges of tables.
Multi-value results: Instructions, blocks, and functions can now return more than one result value, sometimes supporting faster calling conventions and avoiding indirections. In addition, block instructions now also can have inputs, enabling new program transformations.
Reference types: References to functions or pointers to external objects (e.g., JavaScript values) become available as opaque first-class values. Tables are repurposed as a general storage for such reference values, and new instructions allow accessing and mutating tables in Wasm code. In addition, modules now may define multiple tables of different types.
Non-trapping conversions: Additional instructions allow the conversion from float to integer types without the risk of trapping unexpectedly.
Sign extension instructions: A new group of instructions allows directly extending the width of signed integer value. Previously that was only possible when reading from memory.
adrian17 · 4h ago
> Instructions, blocks, and functions can now return more than one result value, sometimes supporting faster calling conventions and avoiding indirections.
Unfortunately, despite being "enabled", Rust+LLVM don't take advantage of this because of ABI compatibility mess. I don't know whether the story on Clang's side is similar.
Dwedit · 46m ago
I figured out the way to get multi-value results on GCC for 32-bit ARM. Use a union to pack two 32-bit values into a 64-bit value. Return the 64-bit value. Then use a union to split the 64-bit value into two 32-bit values. I haven't tested it on other 32-bit architectures though.
acheong08 · 12m ago
I'm using the same trick in Zig via packed structs
"As a result there is no longer any possible method of writing a function in Rust that returns multiple values at the WebAssembly function type level."
Multi-value results are great for prospective Common Lisp runtimes.
immibis · 4h ago
You can have an ISA sufficiently generic to run on any CPU, or one sufficiently specific to efficiently exploit SIMD on a particular CPU. Never both. That's why some platforms provider higher-level operations, like element-wise multiplication of packed arrays. I can't see whether the actual WASM2 SIMD instructions are sufficiently generic because apparently I'm rate-limited on GitHub (???) and therefore can't see the spec.
mdaniel · 41m ago
> apparently I'm rate-limited on GitHub (???) and therefore can't see the spec.
Are you also on Firefox? I've been getting those 429s a lot over the past week or so. I haven't changed my configuration other than I'm religious about the "check for updates" button, but I cannot imagine a world in which my release-branch browser is a novelty. No proxies, yes I run UBO but it is disabled for GH
Values are hardwired to 128 bits which can be i8x16/i16x8/i32x4/i64x2 or f32x4/f64x2, so that already limits the 'feature surface' drastically.
IMHO as long as it covers the most common use cases (e.g. vec4 / mat4x4 floating point math used in games and a couple of common ALU and bit-twiddling operations on integers) that's already quite a bit better than having to fall back to scalar math.
pdubroy · 4h ago
The WebAssembly spec is quite approachable, but for anyone who is interested in learning Wasm and doesn't want to read the spec —
WebAssembly from the Ground Up (https://wasmgroundup.com/) an online book to learn Wasm by building a simple compiler in JavaScript. It starts with handcrafting bytecodes in JS, and then slowly builds up a simple programming language that compiles to Wasm.
const MIN_U32 = 0;
const MAX_U32 = 2 ** 32 - 1;
function u32(v) {
if (v < MIN_U32 || v > MAX_U32) {
throw Error(`Value out of range for u32: ${v}`);
}
return leb128(v);
}
I love Ada, because you can do this:
subtype U32 is Interfaces.Unsigned_64 range 0 .. 2 ** 32 - 1;
Ada keeps being used as example for subranges, however they exist already in Pascal and all Modula variants.
johnisgood · 1h ago
I know. That said, I keep mentioning Ada because it is widely used in mission critical systems, and because it supports contracts (yes, I know, so does Eiffel), and you can do formal verification using Ada / SPARK, meaning that it could be used in place of Rust, whereas Pascal probably not.
MrResearcher · 3h ago
Is it possible to "instrument" the WASM code to enable in-process debugging? In other words, would it be possible to generate WASM based off some input string (my custom language) on-the-fly, and then run it with breakpoints and memory inspection, all within the same Javascript script hosted on, say, a web page?
titzer · 3h ago
Wizard has engine support for instrumentation, but Whamm (https://github.com/ejrgilbert/whamm) can also do instrumentation through bytecode rewriting.
MrResearcher · 3h ago
That still requires the usage of dev tools and linear source code mapping between the original and the generated WASM, correct? Would it be possible to avoid dev tools, and implement the debugger in Javascript? Or the WASM technology doesn't provide such an opportunity?
I'd like to break on breakpoints, jump back into Javascript, unroll it into the original location in the source code, and display it all in an IDE-like window all within a browser page, and without involvement of dev tools (that can't handle non-linear conversions between source code and generated JS/WASM).
gwbas1c · 1h ago
Visual Studio supports debugging C# compiled to WASM when your page is made with Blazor.
Granted, you're debugging in another window that isn't a browser; but overall the debugger is about 80% of what you get when debugging a .net process running outside of the debugger.
titzer · 2h ago
Yes, if you use bytecode rewriting then all the offsets are changed and you need a mapping. This is one of the advantages of engine-side instrumentation; bytecode offsets don't change. It'll be some time before we can get engines to agree on a standard interface for instrumentation, but there have been some discussions.
Whamm can inject arbitrary instrumentation logic, so you could, e.g. inject calls to imports that are implemented in JS. You'll have some heavy lifting to do on the JS side.
pdubroy · 3h ago
I'm not sure I totally understand what you mean by "in-process" here. But you could have some JavaScript that compiles some code in your custom language to WebAssembly and then execute it, and you can use the browser dev tools to set breakpoints the Wasm, inspect the memory, etc.
In the book, we don't cover source maps, but it would also be possible to generate source maps so that you can set breakpoints in (and step through) the original source code in your custom language, rather than debugging at the Wasm instruction level.
Does that answer your question?
MrResearcher · 3h ago
Sadly, no, I'd like to write a ~Prolog interpreter (compiler into WASM that would dynamically replace parts of the implementation as source code evolves), and have the debugger and WASM memory inspector as part of the web page written in Javascript, which was used to compiled the code in the first place.
That is, would it be possible to implement a debugger and memory inspector in Javascript without resorting to dev tools? Prolog doesn't map 1:1 to WASM/Javscript via source maps, making it nearly impossible to properly debug it in dev tools.
Inspecting Wasm memory is easy from JS, but to be able to do the debugging, you'd probably either need to rewrite the bytecode (e.g., inserting a call out to JS between every "real" instruction) or a self-hosted interpreter like wasm3 (https://github.com/wasm3/wasm3).
(Or maybe there are better solutions that I'm not thinking of.)
inoffensivename · 1h ago
I've been working on Webassembly runtimes for the last year or so, specifically on spec compliance and performance. I came to it as a neophyte, but I've become quite fond of the specification. It's a bit hard to get started with the notation, but it's refreshing to have such a thoroughly specified language. There is a reference interpreter generated directly from the spec, which is very useful for resolving questions about what a runtime should do in a given situation.
The provided specification tests allow implementers to be confident that their runtime conforms to the spec.
Overall I think it's an impressive specification and is worth studying .
treetalker · 5h ago
Wasm, per footnote 1:
> A contraction of “WebAssembly”, not an acronym, hence not using all-caps.
esperent · 2h ago
Shouldn't it be WAsm in that case?
jmull · 1h ago
I would say no.
There aren't any particular rules about contractions and intermediate capitalization so we are free to choose. WAsm is more awkward than Wasm so the latter seems better.
shellac · 2h ago
Not that you have to use all caps for acronyms, e.g. scuba, radar, laser.
andybak · 46m ago
I would maybe argue that used to be acronyms but now are just... well, words.
klysm · 2h ago
Good luck lol
Klasiaster · 1h ago
What's truly missing for Wasm and WASI to be an alternative to POSIX is dynamic instatiation so that a Wasm program/component can start another Wasm program/component by providing the bytecode at runtime. So far I don't think anyone is working on that.
if the host provides the guest wasm module via imports a function to create and run from an array of bytes then it can be done today (if I understand you correctly).
I wonder if it hasn't been done because it would break the security model
AlexAltea · 1h ago
Great release with many welcome features. As a nit, I'm rather disappointed at the inclusion of fixed-size SIMD (128-bit wide) instead of adaptive SIMD instructions letting the compiler maximize SIMD width depending on host capabilities, similar to how ARM SVE works.
lifthrasiir · 1h ago
Personally I prefer fixed-size SIMD mainly because it enables more usages than usual vector instructions while vector instructions can be rather trivially lowered to fixed-size SIMD instructions. I'd call them as "opportunistic" usages, because those are perfectly fine without SIMD or vector but only get vectorized due to the relatively small size of SIMD registers. Those usages are significant enough that I see them as useful even with the presence of vector instructions.
camel-cdr · 1h ago
If you have variable length SIMD, you can always treat them as fixed-size SIMD types.
New x86 processor don't executes 128-bit SIMD, the vecto ALUs are all wider now and 128 and 256-bit instructions have the same throughput and latency.
Also, do you have an example for such "opportunistic" usages?
I suppose mainly things the SLP vectorizer can usually do already (in compiled languages, I'm not sure how good the JIT is these days).
I worry that we now may end up in a world, where "hand optimized SIMD" in WASM ends up slower than autovectorization, because you can't use the wider SIMD instructions and leave 2x (zen4) to 4x (zen5) of the performance on the table.
lifthrasiir · 1h ago
> Also, do you have an example for such "opportunistic" usages?
The simplest example would be copying a small number of bytes (like, copying structs). Vector instructions generally have a higher setup cost, like setting so it can't really be used for this purpose. Maybe future vector instructions have no such caveats and can be used as like SIMD, but AFAIK it's not yet the case even for RISC-V's V extension.
anentropic · 3h ago
Are any of the runtimes already implementing this?
adrian17 · 3h ago
Most have been for some time now. As the announcement post says:
> the Wasm Community and Working Groups had reached consensus and finished the specification in early 2022. All major implementations have been shipping 2.0 for even longer.
> In a future post we will take a look at Wasm 3.0, which is already around the corner at this point!
Features in 3.0 presumably also being mostly implemented already, some maybe just kept behind feature flags.
titzer · 2h ago
Everything in 3.0 has at least two browser implementations; that's part of the requirements for advancement to phase 4.
Wasm 2.0 is complete in a handful of engines, whereas 3.0 is less well-supported.
Wizard is almost done with 3.0; only memory64 and relaxed-simd are incomplete.
thrance · 1h ago
Is there anywhere I could look at the "changelogs" between 1.0 and 2.0, and 2.0 and 3.0? All I could find are different versions of the spec that don't seem very keen on expliciting what changed.
iFire · 1h ago
I got blocked writing high level wasm bindings with types other than int or float, is this still the case?
Can WASM be considered "safer" than pure javascript?
marianoguerra · 22m ago
yes:
> WebAssembly provides no ambient access to the computing environment in which code is executed. Any interaction with the environment, such as I/O, access to resources, or operating system calls, can only be performed by invoking functions provided by the embedder and imported into a WebAssembly module.
Without direct browser support for WASM with DOM access ( and no need for JavaScript "shim"), all this is futile.
andai · 3h ago
I did 5 game jams in Web assembly last year and found it quite painful overall.
Emscripten is very bloated, but it's the best option from what I can tell.
I lost a whole day of a 3 day game jam to a weird Emscripten bug. It ended up being that adding a member to a class blew up the whole thing.
The alternative (and the only option, if you want it to be as light as possible) is to do the bindings yourself, which is fun, depending on how much your concept of fun involves JavaScript, and having half your code in a different programming language.
I'm told the Rust situation is pretty nice, although my attempt didn't get anywhere — apparently I tried to use it in exactly the opposite way that it was intended.
I had a pretty nice time with Odin. Someone put raylib wasm bindings for Odin on GitHub, and it worked really well for me.
(Odin syntax is really nice, but you don't realize just how nice, until you port your game to another language!)
Zig was cool, but a bit pedantic for a jam, and a bit unstable (kept finding out of date docs). Didn't see much in the way of game libs, but I was able to ship a Zig game with WASM-4.
I ended up switching to TS, which I'm not happy with, but since you (usually) need JS anyway, the benefit of having a single language, and a reliable toolchain, is very high, especially under time pressure. The "my language is nice" benefits do not in my experience outweigh the rest of the pain.
coffee_am · 3h ago
Just for another data point, I took me 4 days to cook up a WASM front-end using Go for my otherwise command-line only Hive game:
Probably everything JS and DOM is better supported from TS, but I have to say, I was never blocked on my small project.
adrian17 · 3h ago
What do you mean, DOA? It's been in active use for years now.
As far as I know, "2.0" is just a marketing term batching several extensions standardized since 1.0 (and simplifying feature queries "are extensions X,Y,Z supported" to "is 2.0 supported"), not unlike what Vulkan does with their extensions.
cedws · 3h ago
It’s not DOA, it just became everything except anything to do with “web.” The purpose it was invented for has been forgotten.
dgb23 · 18s ago
There are some highly competitive products that use Wasm and plenty of useful libraries. The web is definitely the primary use case.
pjmlp · 3h ago
On the contrary, the browser is the only place where it makes sense.
Outside of the browser are only VC backed companies, pretending bytecode based distribution isn't something existing since 1958, with wins and losses, many of those were polyglot, supporting languages like C in bytecode was already done in 1989 with Architecture Neutral Distribution Format, and many other examples.
adrian17 · 3h ago
I don't know what you're trying to say.
If you're talking about WASI, well personally I'm not interested in it and we're just using plain wasm in the browser. However, nothing in this linked post is about WASI specifically.
krapp · 3h ago
The purpose it was invented for was not the web. WASM was designed from the beginning to be a platform-independent technology[0].
The HN crowd has just always been terminally myopic about this because it has "web" in the name.
It was definitely invented to make everyone happy after the NaCL/PNaCL vs asm.js political wars.
We already have lots of bytecode formats.
johnisgood · 2h ago
> A common misconception is that WebAssembly can only run in web browsers. Although "Web" is part of its name, WebAssembly is not limited to browsers. It's designed to be a platform-independent technology that can run in various environments, including IoT devices, edge computing, artificial intelligence, game development, backend services, or cloud services. Its portable binary format allows it to execute efficiently across different platforms and architectures.
I am not going to lie, I thought the same because of the name, too.
titzer · 2h ago
Think of it like German names, where people are often named for where they came from. Berliner, Münchner, etc. WebAssembly is so named because it came from the web :)
According to those, likely to replace containers and likely to be integreated in more and more systesms.
It seems like it's exploding in populartity and usage because it solves some very real problems.
pjmlp · 2h ago
Hello application servers from 2000's.
wtetzner · 1h ago
Which were mostly tied down to specific languages and GC'd runtimes. You seem to have a big problem with Wasm just because bytecoode runtimes have been done before.
pjmlp · 1h ago
2001 says hi,
"More than 20 programming tools vendors offer some 26 programming languages — including C++, Perl, Python, Java, COBOL, RPG and Haskell — on .NET. "
"The Architecture Neutral Distribution Format (ANDF) in computing is a technology allowing common "shrink wrapped" binary application programs to be distributed for use on conformant Unix systems, translated to run on different underlying hardware platforms. ANDF was defined by the Open Software Foundation and was expected to be a "truly revolutionary technology that will significantly advance the cause of portability and open systems",[1] but it was never widely adopted."
"The Amsterdam Compiler Kit (ACK) is a retargetable compiler suite and toolchain written by Andrew Tanenbaum and Ceriel Jacobs, since 2005 maintained by David Given.[1] It has frontends for the following programming languages: C, Pascal, Modula-2, Occam, and BASIC."
I have a problem with people selling WASM as something spectacullary new, never done before.
adwn · 1h ago
> I have a problem with people selling WASM as something spectacullary new, never done before.
Nobody is doing this here, you're arguing against a strawman.
qoez · 3h ago
Personally I don't find it that painful to write the little js code to send browser input to wasm. I'm having a lot of fun with it. Just the simd stuff to speed up whatever you're working with is often worth writing a c version of things.
lifthrasiir · 4h ago
Might be futile for the broader scope, but the main scope of enabling native code in the browser would remain strong.
baudaux · 2h ago
Maybe a WASI DOM could help ?
TekMol · 4h ago
I'm still skeptical about the whole Wasm ordeal.
If you want to run code written in other languages in the browser, you could just as well compile to JavaScript.
All Wasm brings to the table is a bit of a speed improvement.
macguillicuddy · 3h ago
We do high performance computer vision in the browser (at 30/60 fps) that's an order of magnitude faster in WASM than JS. It simply would not be fast enough without WASM.
TekMol · 1h ago
Interesting. Really an order of magnitude?
What types of operations are 10x faster in Wasm than in JS? Why can't the JIT compiler compile JS to the same native code as your Wasm gets compiled to?
macguillicuddy · 23m ago
We have tight inner loops over large numbers of pixels - in some cases optimized to the level of careful register choice and SIMD
pjmlp · 2h ago
You could offload to WebGL/WebGPU for that.
macguillicuddy · 21m ago
We do for some elements of our pipeline. WebGPU will give us more opporunity for this in the future too but right now we need broader device support unfortunately.
wtetzner · 2h ago
Sure, but that's much more complex to implement, and comes with its own overhead.
pjmlp · 1h ago
Not that WASM tooling is such an example of great developer experience.
coffeeindex · 2h ago
Or you could use Wasm
pjmlp · 1h ago
WASM is slower, and the toolchain sucks for most languages.
adwn · 1h ago
> WASM is slower […]
Without more details on their exact use case, their algorithms, and their data movement patterns, you have no way of knowing this. Doing stuff on the GPU isn't automatically faster than doing it on the CPU.
cheschire · 4h ago
It’s not a complete replacement for JS transpiling. It has some advantages for specific use cases. A couple benefits I like are:
Not having the JS GC randomly pausing your process unpredictably.
Sandboxing untrusted code, i.e. you sell a SaaS and you also want clients to be able to run untrusted plugins from a marketplace.
TekMol · 1h ago
You can use fixed data structures like Uint8Array in JavaScript just like you can (have to?) in Wasm. Then you won't have the GC do stuff, right?
intelVISA · 16m ago
Same, it still feels like too much of a grift for VC monies to me.
Not a hater, though it's fun to run Doom in a browser tab... just can't see any business value in 99% of its ecosystem, especially with the drift away from web (the only niche where it made sense).
davidmurdoch · 2h ago
If JS had native SIMD, probably. But it doesn't, and it won't (because it's complex to do in JS, and you can just use Wasm instead), so it really can't compete because of just how much faster Wasm can be these days.
TekMol · 1h ago
So how much faster than JS is Wasm for typical use-cases?
qoez · 3h ago
Wasm with simd can get things like physics simulation and some ML on the order of 2x faster. I'm finding it really useful.
pjmlp · 2h ago
Or let the GPU do it instead.
qoez · 2h ago
For physics it's in some cases way easier to implement on cpu. For ML using wasm means the model loads way faster (the user doesn't have to wait; and sometimes the performance is about the same). For some small models wasm can be faster. Mediapipe by google for instance gets better performance and better latency with their wasm model than the gpu one.
emaro · 3h ago
Even if this were true, 'a bit of a speed improvement' is still huge given the amount of JS that's run in our world.
Wasm 2.0 Completed - https://webassembly.org/news/2025-03-20-wasm-2.0/
> ..here is the summary of the additions in version 2.0 of the language:
Vector instructions: With a massive 236 new instructions — more than the total number Wasm had before — it now supports 128-bit wide SIMD (single instruction, multiple data) functionality of contemporary CPUs, like Intel’s SSE or ARM’s SVE. This helps speeding up certain classes of compute-intense applications like audio/video codecs, machine learning, and some cryptography.
Bulk memory instructions: A set of new instructions allows faster copying and initialization of regions of memory or ranges of tables.
Multi-value results: Instructions, blocks, and functions can now return more than one result value, sometimes supporting faster calling conventions and avoiding indirections. In addition, block instructions now also can have inputs, enabling new program transformations.
Reference types: References to functions or pointers to external objects (e.g., JavaScript values) become available as opaque first-class values. Tables are repurposed as a general storage for such reference values, and new instructions allow accessing and mutating tables in Wasm code. In addition, modules now may define multiple tables of different types.
Non-trapping conversions: Additional instructions allow the conversion from float to integer types without the risk of trapping unexpectedly.
Sign extension instructions: A new group of instructions allows directly extending the width of signed integer value. Previously that was only possible when reading from memory.
Unfortunately, despite being "enabled", Rust+LLVM don't take advantage of this because of ABI compatibility mess. I don't know whether the story on Clang's side is similar.
"As a result there is no longer any possible method of writing a function in Rust that returns multiple values at the WebAssembly function type level."
And similar queries in Rust's zulip: https://rust-lang.zulipchat.com/#narrow/channel/122651-gener...
Are you also on Firefox? I've been getting those 429s a lot over the past week or so. I haven't changed my configuration other than I'm religious about the "check for updates" button, but I cannot imagine a world in which my release-branch browser is a novelty. No proxies, yes I run UBO but it is disabled for GH
Values are hardwired to 128 bits which can be i8x16/i16x8/i32x4/i64x2 or f32x4/f64x2, so that already limits the 'feature surface' drastically.
IMHO as long as it covers the most common use cases (e.g. vec4 / mat4x4 floating point math used in games and a couple of common ALU and bit-twiddling operations on integers) that's already quite a bit better than having to fall back to scalar math.
WebAssembly from the Ground Up (https://wasmgroundup.com/) an online book to learn Wasm by building a simple compiler in JavaScript. It starts with handcrafting bytecodes in JS, and then slowly builds up a simple programming language that compiles to Wasm.
There's a free sample available: https://wasmgroundup.com/book/contents-sample/
(Disclaimer: I'm one of the authors)
Granted, you're debugging in another window that isn't a browser; but overall the debugger is about 80% of what you get when debugging a .net process running outside of the debugger.
Whamm can inject arbitrary instrumentation logic, so you could, e.g. inject calls to imports that are implemented in JS. You'll have some heavy lifting to do on the JS side.
In the book, we don't cover source maps, but it would also be possible to generate source maps so that you can set breakpoints in (and step through) the original source code in your custom language, rather than debugging at the Wasm instruction level.
Does that answer your question?
re: "dynamically replace parts of the implementation as source code evolves" — there is a technique for this, I have a short write-up on it here: https://github.com/pdubroy/til/blob/main/wasm/2024-02-22-Run...
About the debugging and inspecting —
Inspecting Wasm memory is easy from JS, but to be able to do the debugging, you'd probably either need to rewrite the bytecode (e.g., inserting a call out to JS between every "real" instruction) or a self-hosted interpreter like wasm3 (https://github.com/wasm3/wasm3).
(Or maybe there are better solutions that I'm not thinking of.)
The provided specification tests allow implementers to be confident that their runtime conforms to the spec.
Overall I think it's an impressive specification and is worth studying .
> A contraction of “WebAssembly”, not an acronym, hence not using all-caps.
There aren't any particular rules about contractions and intermediate capitalization so we are free to choose. WAsm is more awkward than Wasm so the latter seems better.
if the host provides the guest wasm module via imports a function to create and run from an array of bytes then it can be done today (if I understand you correctly).
Here's some related content: https://github.com/pdubroy/til/blob/main/wasm/2024-02-22-Run...
New x86 processor don't executes 128-bit SIMD, the vecto ALUs are all wider now and 128 and 256-bit instructions have the same throughput and latency.
Also, do you have an example for such "opportunistic" usages?
I suppose mainly things the SLP vectorizer can usually do already (in compiled languages, I'm not sure how good the JIT is these days).
I worry that we now may end up in a world, where "hand optimized SIMD" in WASM ends up slower than autovectorization, because you can't use the wider SIMD instructions and leave 2x (zen4) to 4x (zen5) of the performance on the table.
The simplest example would be copying a small number of bytes (like, copying structs). Vector instructions generally have a higher setup cost, like setting so it can't really be used for this purpose. Maybe future vector instructions have no such caveats and can be used as like SIMD, but AFAIK it's not yet the case even for RISC-V's V extension.
> the Wasm Community and Working Groups had reached consensus and finished the specification in early 2022. All major implementations have been shipping 2.0 for even longer.
> In a future post we will take a look at Wasm 3.0, which is already around the corner at this point!
Features in 3.0 presumably also being mostly implemented already, some maybe just kept behind feature flags.
Wasm 2.0 is complete in a handful of engines, whereas 3.0 is less well-supported.
Wizard is almost done with 3.0; only memory64 and relaxed-simd are incomplete.
with the component model's wit you get higher level types like enums, option, result and generics: https://component-model.bytecodealliance.org/design/wit.html
[1] https://github.com/speced/bikeshed
> WebAssembly provides no ambient access to the computing environment in which code is executed. Any interaction with the environment, such as I/O, access to resources, or operating system calls, can only be performed by invoking functions provided by the embedder and imported into a WebAssembly module.
more info here:
- https://webassembly.org/docs/security/
- https://www.w3.org/TR/wasm-core-1/#design-goals%E2%91%A0
Without direct browser support for WASM with DOM access ( and no need for JavaScript "shim"), all this is futile.
Emscripten is very bloated, but it's the best option from what I can tell.
I lost a whole day of a 3 day game jam to a weird Emscripten bug. It ended up being that adding a member to a class blew up the whole thing.
The alternative (and the only option, if you want it to be as light as possible) is to do the bindings yourself, which is fun, depending on how much your concept of fun involves JavaScript, and having half your code in a different programming language.
I'm told the Rust situation is pretty nice, although my attempt didn't get anywhere — apparently I tried to use it in exactly the opposite way that it was intended.
I had a pretty nice time with Odin. Someone put raylib wasm bindings for Odin on GitHub, and it worked really well for me.
(Odin syntax is really nice, but you don't realize just how nice, until you port your game to another language!)
Zig was cool, but a bit pedantic for a jam, and a bit unstable (kept finding out of date docs). Didn't see much in the way of game libs, but I was able to ship a Zig game with WASM-4.
I ended up switching to TS, which I'm not happy with, but since you (usually) need JS anyway, the benefit of having a single language, and a reliable toolchain, is very high, especially under time pressure. The "my language is nice" benefits do not in my experience outweigh the rest of the pain.
https://janpfeifer.github.io/hiveGo/www/hive/
Probably everything JS and DOM is better supported from TS, but I have to say, I was never blocked on my small project.
As far as I know, "2.0" is just a marketing term batching several extensions standardized since 1.0 (and simplifying feature queries "are extensions X,Y,Z supported" to "is 2.0 supported"), not unlike what Vulkan does with their extensions.
Outside of the browser are only VC backed companies, pretending bytecode based distribution isn't something existing since 1958, with wins and losses, many of those were polyglot, supporting languages like C in bytecode was already done in 1989 with Architecture Neutral Distribution Format, and many other examples.
If you're talking about WASI, well personally I'm not interested in it and we're just using plain wasm in the browser. However, nothing in this linked post is about WASI specifically.
The HN crowd has just always been terminally myopic about this because it has "web" in the name.
[0]https://learn-wasm.dev/tutorial/introduction/what-webassembl...
We already have lots of bytecode formats.
I am not going to lie, I thought the same because of the name, too.
https://www.youtube.com/@wasmio
According to those, likely to replace containers and likely to be integreated in more and more systesms.
It seems like it's exploding in populartity and usage because it solves some very real problems.
"More than 20 programming tools vendors offer some 26 programming languages — including C++, Perl, Python, Java, COBOL, RPG and Haskell — on .NET. "
https://news.microsoft.com/source/2001/10/22/massive-industr...
Ah, it isn't portable, maybe 1989?
"The Architecture Neutral Distribution Format (ANDF) in computing is a technology allowing common "shrink wrapped" binary application programs to be distributed for use on conformant Unix systems, translated to run on different underlying hardware platforms. ANDF was defined by the Open Software Foundation and was expected to be a "truly revolutionary technology that will significantly advance the cause of portability and open systems",[1] but it was never widely adopted."
https://en.wikipedia.org/wiki/Architecture_Neutral_Distribut... or better 1980?
"The Amsterdam Compiler Kit (ACK) is a retargetable compiler suite and toolchain written by Andrew Tanenbaum and Ceriel Jacobs, since 2005 maintained by David Given.[1] It has frontends for the following programming languages: C, Pascal, Modula-2, Occam, and BASIC."
https://en.wikipedia.org/wiki/Amsterdam_Compiler_Kit
I have a problem with people selling WASM as something spectacullary new, never done before.
Nobody is doing this here, you're arguing against a strawman.
If you want to run code written in other languages in the browser, you could just as well compile to JavaScript.
All Wasm brings to the table is a bit of a speed improvement.
What types of operations are 10x faster in Wasm than in JS? Why can't the JIT compiler compile JS to the same native code as your Wasm gets compiled to?
Without more details on their exact use case, their algorithms, and their data movement patterns, you have no way of knowing this. Doing stuff on the GPU isn't automatically faster than doing it on the CPU.
Not having the JS GC randomly pausing your process unpredictably.
Sandboxing untrusted code, i.e. you sell a SaaS and you also want clients to be able to run untrusted plugins from a marketplace.
Not a hater, though it's fun to run Doom in a browser tab... just can't see any business value in 99% of its ecosystem, especially with the drift away from web (the only niche where it made sense).