News for hackers. Stuff that matters.
Re:Concurrent JavaScript: It can work by kllrnohj on Wednesday August 30, 2017 @02:06PM (#15134480)
It'd also be nice if immutable objects could just be shared instead of copied or transferred instead of the current situation where they are copied and then made mutable.
Re:Concurrent JavaScript: It can work by alayek on Wednesday August 30, 2017 @02:21PM (#15134611)
> instead of the current situation where they are copied and then made mutable.

Could you share an example? As far as I understand, Immutable JS uses something like a trie for structural sharing and avoids memory leaks.

Re:Concurrent JavaScript: It can work by kllrnohj on Wednesday August 30, 2017 @04:03PM (#15135487)
When you send the result of Object.freeze() to or from a WebWorker the object is still copied and comes out the other side as fully mutable (aka, not frozen).

Immutable JS is orthogonal in this case. That's "just" a fancy wrapper on top of a bunch of regular, mutable JS objects that makes it look immutable. It's not truly immutable to the runtime, and has no special interaction with webworkers as a result. It gets deep copied just like any other object.