planttheidea / crio

Immutable objects and arrays in a natural way
MIT License
211 stars 12 forks source link

Difference with seamless-immutable? #6

Closed FezVrasta closed 8 years ago

FezVrasta commented 8 years ago

https://github.com/rtfeldman/seamless-immutable

They both look pretty similar, they both want to provide access to the native API of JS... What's the difference?

tquetano-r7 commented 8 years ago

I actually call this out in the documentation... seamless-immutable simply throws an error when you try to do a natively mutable function:

const array = Immutable(['foo']);

array.push('bar');

// ImmutableError is thrown

crio goes more the direction of ImmutableJS where the native mutable API is replaced with an immutable version:

const array = Immutable(['foo']);
const newArray = array.push('bar');

// newArray is now ['foo', 'bar']

This felt more natural to me, but also prevents the developer from figuring out how to actually do an immutable push on their own. Neither one is better or worse, just a different approach.

FezVrasta commented 8 years ago

I see, thanks!