Try   HackMD

DRAFT SharedValueTable Proposal

[Serializable]
interface SharedValueTable {
    undefined insert([EnforceRange] unsigned long long key, any value); // value must be serializable
    any get([EnforceRange] unsigned long long key);
    undefined remove([EnforceRange] unsigned long long key);
};

TODO write more

Keeping track of some use cases, and random thoughts

  • Thread-shareable objects
    • WebGPU objects (get needs to be FAST, avoid locks)
    • By construction, also SharedArrayBuffers and other SharedValueTables
    • For performance reasons it's probably ideal for `get()`` to cache the object it returns so it can return the same one again (in the case of thread-shareable objects at least)
  • Regular serializable values (like numbers, JS objects, etc.)
    • These would NOT be by reference; if you get() an object out of the table and modify it, the modifications shouldn't magically show up elsewhere
    • Maybe this slightly conflicts with the `get()`` caching above
  • Blobs (audio, images, other files), e.g. being loaded into a game engine