News for hackers. Stuff that matters.
Re:Immutable.js – Immutable Data Collections by gcanti on Saturday November 01, 2014 @07:14AM (#8542716)
What do you think about vanilla `Object.freeze`? Any drawbacks? Here my considerations at the moment:

Pros:

- you can use native data structures instead of continually wrap / unwrap

- you can use native methods on them (map, filter, ...)

- hence (almost) no interoperability problems with other libraries

- overall your coding style doesn't change so much

- (possible perf gains since the js engine knows the object is frozen? - I really don't know)

- EDIT: 0KB dependency

Cons:

- you must find / write a way to update efficiently

Re:Immutable.js – Immutable Data Collections by swannodette on Saturday November 01, 2014 @07:25AM (#8542730)
Lack of update is a show stopper. In general I would expect Immutable JS to trounce anything via Object.freeze with respect to performance. Real hash maps and sets are useful to organize programs - the semantics of Object.freeze on ES6 Map and Set are unclear and still suffer from above problems. Again Immutable JS has a big advantage.

In the context of building real applications with immutable data structures and a library like React that makes them easy to integrate - many of your concerns don't apply at all.

Re:Immutable.js – Immutable Data Collections by gcanti on Saturday November 01, 2014 @08:24AM (#8542820)
> Lack of update is a show stopper

Well, it's quite easy to write something like Facebook Immutability Helpers [1]. As you correctly stated, it really depends on your own use case and performance issues.

I'll try some perf experiment with [1] or something similar to see what comes out.

[1]: http://facebook.github.io/react/docs/update.html

Re:Immutable.js – Immutable Data Collections by Too on Saturday November 01, 2014 @08:52AM (#8542870)
Last time i checked Object.freeze actually made things slower, alot slower. Sounds counter intuitive and it might eventually change but that's the current state in most popular browsers.
Re:Immutable.js – Immutable Data Collections by leebyron on Saturday November 01, 2014 @09:45PM (#8545295)
This is pretty unfortunate.

At Facebook we use Object.freeze in a number of places to express POJSO immutability. A technique we've used to deal with the performance hit is to make most of these Object.freeze calls a no-op in a production environment.

Most FB employees (incl non-devs) load the site in development mode, so we still get the stricter error messages.