structuredClone() as ECMAScript standard

While structuredClone() is presumably not related to any API (such as the DOM, file system or other), why is it not part of ECMAScript?

Is there anything that prevents such a function from being defined as an ECMAScript standard?

Are there any plans to add this or a similar function to the ECMAScript standard?

https://github.com/tc39/ecma262/issues/2555

1 Like

That issue is pretty long, but the TLDR is that some delegates have concerns with the way the structured clone algorithm handles some cases, in particular that it reaches for internal slots and is thus not proxy transparent.

As such the current path considered is to move the algorithm to the ecma262 spec, but only with the goal to move its maintenance to TC39. The structureClone() function would itself not become part of ecma262.

That said I have been wanting for a few years to introduce a mechanism to make structured cloning extensible, which I believe would effectively satisfy some of the concerns with the current algorithm.

That would have to go through the proposal process once I find time to champion it.

2 Likes