News for hackers. Stuff that matters.
Re:Immutable JavaScript data structures, backwards-compatibl... by evv on Monday November 03, 2014 @05:29PM (#8553987)
How does this compare to https://github.com/facebook/immutable-js ? Has anybody used both?
Re:Immutable JavaScript data structures, backwards-compatibl... by Sonata on Monday November 03, 2014 @07:28PM (#8554498)
From what I can see, seamless-immutable basically just enforces immutability on native JavaScript data structures. Immutable.js on the other hand, implements full persistent data structures, which give much better time complexity guarantees about important operations. Immutable.js also has a rich API designed for manipulating immutable data structures and uses lazy evaluation for methods like map, filter and concat, which really improves performance when chaining chose operations.
Re:Immutable JavaScript data structures, backwards-compatibl... by pimlottc on Tuesday November 04, 2014 @01:54AM (#8555408)
They both mimic the standard Array/Map/Set methods but differ in how they handle mutating methods like push and set. In Facebook's version, these functions return a new immutable instance with the values changed appropriately, while this one throws an error. It also provides a few new methods to combine/transform existing immutables.

I like the look of this one better. IMHO Facebook's approach will lead to confusion and subtle errors when their immutables are mixed up with normal objects and arrays. Personally I think this is think that's an unwise decision that will lead to confusion and subtle errors.

Re:Immutable JavaScript data structures, backwards-compatibl... by drawkbox on Monday November 03, 2014 @06:55PM (#8554363)
You have to convert to and from js objects with the facebook one (immutable-js), although lots of the js api calls are the same push/set/slice etc.

This one is directly on js objects (seamless-immutable).