Off The Main Thread

TC39 Roundup Drama Edition Part I: Shared Structs

Off The Main Thread

In this episode, Surma talks about the Stage 2 proposal "JavaScript Struct", which introduces fixed-layout objects and the ability to share them between realms.

Notes & Corrections from Shu:

Surma was slightly wrong about why private fields were originally considered problematic for sharability. The problem occurs when a class can be evaluated multiple times:

function makeClass() {   return class MyClass {      #priv;      getPrivateField(instance) {        return instance.#priv;      }    }; } const C1 = makeClass(); const C2 = makeClass(); const i1 = new C1(); const i2 = new C2(); // this throws! i1.getPrivateField(i2); 

This behavior makes it hard to compile private fields just as "slots" on an object, as clearly additional behavior is required. This is somewhat at odds with the goal of achieving a fixed layout.

Also, launching is mid-2025 is very optimistic.

Resources:

Next Episodes

Off The Main Thread

More build tools: Nix @ Off The Main Thread

πŸ“† 2024-10-29 16:06 / βŒ› 00:41:06


Off The Main Thread

The new stylable select element @ Off The Main Thread

πŸ“† 2024-10-08 14:38 / βŒ› 00:45:29


Off The Main Thread

Chrome's new LLM AI API OMG @ Off The Main Thread

πŸ“† 2024-08-30 14:38 / βŒ› 00:38:23


Off The Main Thread

Chrome’s secretly installed extensions @ Off The Main Thread

πŸ“† 2024-08-06 12:22 / βŒ› 00:29:41


Off The Main Thread

Are web components worth it? @ Off The Main Thread

πŸ“† 2024-06-12 15:44 / βŒ› 00:43:15