8 ms·
I just did a deep dive into this (pun intended). The name appears to date back well over a decade (probably longer) and has roots in lower-level browser APIs li
by HellsMaddy 3y ago
I just did a deep dive into this (pun intended). The name appears to date back well over a decade (probably longer) and has roots in lower-level browser APIs like the implementation of `postMessage`.
> Structured cloning algorithm defines the semantics of copying a well-defined subset of ECMAScript objects between Code Realms. This algorithm is extensible by host enviroment to support cloning of host objects.
https://github.com/dslomov/ecmascript-structured-clone https://github.com/dslomov/ecmascript-structured-clone
Eventually, in 2015, it was suggested to expose the `structuredClone` algorithm as an API:
> Has anyone ever proposed exposing the structured clone algorithm directly
as an API? Katelyn Gadd was musing about fast deep copy in JS on Twitter,
and I proposed a hack to use postMessage to do so[1], which works but it's
a little roundabout. Since structured clone is a primitive that the web
platform is built on it seems like a primitive that ought to be exposed. I
know this exists in other languages (Python has copy.deepcopy[2]) and
there's an npm "deepcopy" module[3] with lots of downloads so this is
clearly something people use.
https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0251.html https://lists.w3.org/Archives/Public/public-webapps/2015AprJ...
- eviks 3y agoThank you, have you seen whether there was any consideration of the obvious naming flaw? Don't see anything in these links
- HellsMaddy 3y agoI was trying to find something about that, but wasn't able to. I would be very curious if someone else can find meeting minutes or mailing list posts where they discuss it.
- n2d4 3y agoWhat is the flaw exactly? Or you mean that "deep" is just a better/more well-known name?