Skip to content
This repository has been archived by the owner on Oct 6, 2021. It is now read-only.

Subsumed by self.structuredClone? #3

Closed
littledan opened this issue Jul 16, 2018 · 2 comments
Closed

Subsumed by self.structuredClone? #3

littledan opened this issue Jul 16, 2018 · 2 comments

Comments

@littledan
Copy link

If HTML adds a structuredClone method, would it still make sense to expose an ArrayBuffer.transfer operation? It seems that you could use structuredClone for very similar purposes, though it's only available on the web. cc @surma

@domenic
Copy link
Owner

domenic commented Jul 16, 2018

I think there's value in saying what you mean, and exposing the appropriate low-level primitives.

Having to use

const transferred = structuredClone(arrayBuffer, [arrayBuffer]);

to convey the semantic of "transfer this array buffer" is pretty opaque.

And, tying up the low-level ability to transfer array buffers inside the higher-level, recursive-object-graph-crawling, multi-function structured cloning algorithm is pretty silly. I'd rather move toward high-level features like structured clone be implementable in JavaScript, by making it possible to transfer individual transferables, instead of inverting things and using structured clone to get at low-level functionality.

@domenic
Copy link
Owner

domenic commented Oct 5, 2021

Withdrawing the proposal after all, in favor of self.structuredClone() and https://github.com/tc39/proposal-resizablearraybuffer

@domenic domenic closed this as completed Oct 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants