top | item 18443211

(no title)

malcolmwhite | 7 years ago

Using structured cloning for deep copies is clever, but may or may not give you the behavior you want for SharedArrayBuffers. The copied value would be a new SAB with the same underlying data buffer, so that changes to one value will be visible to the other. That's good for most uses of structured cloning, but it's not what I would expect from a deep copy.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

discuss

order

Null-Set|7 years ago

The point of structured clone was originally for passing data to web workers. Since the point of shared array buffers is to share data with workers, it makes sense that the structured clone algorithm keeps the SAB identity.

bcoates|7 years ago

Programs that use SharedArrayBuffers are already defective, so it's no big deal.

yzmtf2008|7 years ago

Not true. Chrome has enabled SharedArrayBuffers again as of Chrome 68.