News for hackers. Stuff that matters.
Re:Concurrent JavaScript: It can work by phailhaus on Wednesday August 30, 2017 @02:02PM (#15134440)
JS already supports immutable objects, by using Object.freeze().
Re:Concurrent JavaScript: It can work by bzbarsky on Wednesday August 30, 2017 @03:20PM (#15135082)
That doesn't really make things immutable. Even ignoring the deep vs shallow issue, consider what effect Object.freeze has on a JS Map (hint: none, really; you can still add/remove things).
Re:Concurrent JavaScript: It can work by phailhaus on Wednesday August 30, 2017 @03:44PM (#15135305)
Right, that's where libraries like ImmutableJS come in.
Re:Concurrent JavaScript: It can work by spankalee on Wednesday August 30, 2017 @02:04PM (#15134456)
That's not deeply immutable like you'd want for sharing objects across threads, or even for using in contexts like React and Redux.
Re:Concurrent JavaScript: It can work by phailhaus on Wednesday August 30, 2017 @02:16PM (#15134566)
Not too hard to call Object.freeze() recursively to get the deep immutability you need. And of course there's ImmutableJS for other immutable data structures.