reference-types VS exception-handling

Compare reference-types vs exception-handling and see what are their differences.

reference-types

Proposal for adding basic reference types (anyref) (by WebAssembly)

exception-handling

Proposal to add exception handling to WebAssembly (by WebAssembly)
Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
reference-types exception-handling
9 7
151 142
- 4.2%
5.3 6.8
over 2 years ago 14 days ago
WebAssembly WebAssembly
GNU General Public License v3.0 or later GNU General Public License v3.0 or later
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

reference-types

Posts with mentions or reviews of reference-types. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-11-03.
  • Old CSS, new CSS (2020)
    1 project | news.ycombinator.com | 13 Apr 2024
    > It could be an interesting use case for WASM if the problem of passing data into the WASM VM cheaply (perhaps by reference) can be solved.

    WASM Reference Types should hopefully solve this. The WASM working group seems to have some good momentum - so I'm hopeful this (or a similar replacement spec) will land sooner rather than later.

    https://github.com/WebAssembly/reference-types/blob/master/p...

  • Bring garbage collected programming languages efficiently to WebAssembly
    16 projects | news.ycombinator.com | 3 Nov 2023
    AFAIK GC is irrelevant for "direct DOM access", you would rather want to hop into the following rabbit hole:

    - reference types: https://github.com/WebAssembly/reference-types/blob/master/p...

    - interface types (inactive): https://github.com/WebAssembly/interface-types/blob/main/pro...

    - component model: https://github.com/WebAssembly/component-model

    If this looks like a mess, that's because it is. Compared to that, the current solution to go through a Javascript shim doesn't look too bad IMHO.

  • Extism: Make all software programmable with WebAssembly
    14 projects | news.ycombinator.com | 1 Dec 2022
    [1]: https://github.com/WebAssembly/proposals

    A glance of the overview and spec seems to indicate that WASM will provide some primitive data types, and any GC language can build their implementation on top of it. As I understand it, it's heavily based on Reference Types[3], which allows acting on host-provided types, and is already considered part of the spec [4]. It doesn't remove the need for the 5 different runtimes to have their own GC, but it lowers the bulk that the runtimes need to carry around, and offloads some of that onto the WASM runtime instead.

    [3]: https://github.com/WebAssembly/reference-types/blob/master/p...

  • Struggling to find yew benchmarks
    2 projects | /r/rust | 4 Sep 2022
    They've talked about interface types, and added reference types, which is a stepping stone toward the GC extension proposal, which would be a stepping stone toward manipulating the DOM from the WebAssembly side, but their official roadmap page is more short-term.
  • Blazor WASM and privacy
    1 project | /r/dotnet | 6 Nov 2021
    Nope, WASM reference types, it has nothing to do with .NET type system.
  • FFmpeg for browser and node, powered by WebAssembly
    6 projects | news.ycombinator.com | 20 Aug 2021
    > And there's been talk of exposing the JS GC to wasm for a few years. Hopefully when that stuff lands, it'll get easier to marshal objects across the gap.

    You don't need a Wasm GC to do this. If you only need js objects to pass on to, say, the host's function or check is null or not, then reference types that are opaque external references: https://github.com/WebAssembly/reference-types/blob/master/p...

    You can even do many more things if you export `Reflect` to WebAssembly: https://github.com/AssemblyScript/assemblyscript/blob/main/t...

    Reference Types are available almost everywhere already (In Safari will be available after 15.0): https://webassembly.org/roadmap

  • WebContainers: Run Node.js natively in the browser
    11 projects | news.ycombinator.com | 20 May 2021
  • Cranelift, Part 3: Correctness in Register Allocation
    4 projects | /r/rust | 15 Mar 2021
    Re: GC -- yes, indeed, the whole business with safepoints arose from the need to support Wasm reference types as a backend for Wasmtime or Firefox. No safepoints are needed for Rust (or other C-like) code.
  • Wasmer 1.0 released, the fastest WebAssembly VM, cross-compilation, headless, native object engine, AOT compilers and more!
    11 projects | /r/programming | 7 Jan 2021
    Reference Types,

exception-handling

Posts with mentions or reviews of exception-handling. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-11-03.
  • Bring garbage collected programming languages efficiently to WebAssembly
    16 projects | news.ycombinator.com | 3 Nov 2023
    Interesting article, thanks!

    Notes on the issues mentioned there:

    * The need for a manual shadow stack: This is fixed in WasmGC (in the same way it works in JS, as the link mentions).

    * Lack of try-catch: This is fixed by the Wasm exception handling proposal, which has already shipped in browsers, https://github.com/WebAssembly/exception-handling/blob/main/...

    * Null checks: Mostly fixed by WasmGC. The spec defines non-nullable local types, and VMs can use the techniques the article mentions to optimize them using signals (Wizard does, for example).

    * Class initialization: This is a difficult problem, as the article says. J2Wasm and Binaryen are working to optimize it through static analysis at the toolchain level. Here is a recent PR I wrote that makes progress there: https://github.com/WebAssembly/binaryen/pull/6061

    * The vtable overhead issue the article mentions may be a problem. I'm not aware of good measurements on it, through. There are some ideas on post-MVP solutions for method dispatch that might help, but nothing concrete yet.

    * Checks for null and trapping: There has been discussion of variants on the GC instructions that throw instead of trap. Measurements, however, have not shown it to be a big problem atm, so it is low priority.

    The author is right that stack walking, signals, and memory control are important areas that could help here.

    Overall with WasmGC and exceptions we are in a pretty good place for Java as emitted by J2Wasm today: it is usually faster than J2CL which compiles Java to JavaScript. But there is definitely room for improvement.

  • In the latest demo with Dart, WebAssembly and GC in Chrome how was the Exception Handling solved?
    1 project | /r/dartlang | 1 Feb 2023
    It uses https://github.com/WebAssembly/exception-handling/blob/master/proposals/exception-handling/Exceptions.md which is actually supported by all major browsers already.
  • 'The best thing we can do today to JavaScript is to retire it,' says JSON creator Douglas Crockford
    6 projects | /r/javascript | 5 Aug 2022
    Yep, you're right. It's also more than just the DOM, it's web APIs in general, such as fetch, audio, webgl/webgpu, etc. WASM still needs GC, exceptions, and WASI to be able to fully interop with any host without any of the current limitations. This'll take a few years. I'm looking forward to the future in which I will be shipping WASM-only web apps to my users.
  • WebAssembly Everywhere
    4 projects | /r/programming | 25 Jun 2022
    Its a part of the wasm plan to support gc https://github.com/WebAssembly/gc exceptions https://github.com/WebAssembly/exception-handling
  • What's New in Node.js 17
    3 projects | dev.to | 17 Nov 2021
    As of Node.js 17, the v8 JavaScript engine has been updated to v9.5. The changes in this release are primarily aimed at expanding internationalization for dates and calendars as well as for the output of time zones. It also implements the WebAssembly Exception Handling proposal, designed to reduce overhead compared to current JavaScript-based workarounds.
  • WebContainers: Run Node.js natively in the browser
    11 projects | news.ycombinator.com | 20 May 2021
  • Google admits Kubernetes container tech is too complex
    8 projects | news.ycombinator.com | 25 Feb 2021
    Agreed, although at some point in a not very far feature most of those missing features will resolved. So in my mind is just a matter of time. The Wasm Community group is doing an awesome work on that :)

    Here are a few examples of what needs move forward in Wasm:

    * [1] Wasm Exceptions Handling: Right now Wasm is missing a way to handle exceptions natively (C++ programs can only compile to Wasm using the asyncify or longjmp/setjmp tricks via Js try/catch)

    * [2] Wasm GC: Wasm Binary files are quite big (specially in interpreted languages). This is partially caused by the GC being included in the Binary itself. The GC proposal will solve this while also providing faster execution.

    * [3] Wasm 64-bit Memory: currently Wasm can only operate with 32-bit data. In some contexts you may want you operate with more than 4GB of memory (for example, when operating over terabytes of data). The 64-bit memory proposal will solve that.

    [1]: https://github.com/WebAssembly/exception-handling

What are some alternatives?

When comparing reference-types and exception-handling you can also consider the following projects:

assemblyscript - A TypeScript-like language for WebAssembly.

Uno Platform - Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported.

wasmtime - A fast and secure runtime for WebAssembly

Flutter - Flutter makes it easy and fast to build beautiful apps for mobile and beyond

ffmpeg.wasm - FFmpeg for browser, powered by WebAssembly

simd - Branch of the spec repo scoped to discussion of SIMD in WebAssembly

proposals - Tracking WebAssembly proposals

schism - A self-hosting Scheme to WebAssembly compiler

Dokku - A docker-powered PaaS that helps you build and manage the lifecycle of applications

webcontainer-core - Dev environments. In your web app.