Hacker News new | past | comments | ask | show | jobs | submit login

If you have immutable objects (doesn't even have to be ImmutableJS, you can just decide to never mutate object properties), then there's really not even a need for cloning at that point. The reason you would clone an object is to avoid mutating the original object, which you don't need to worry about when everything is immutable.



Except that you need to copy _something_ at some point to modify values (or more precisely, having another object that is the same but with X change). In theory everything is re-created with a change, but in practice only the changed objects are copied.


Immutable objects aren't very useful if you can't create mutated copies...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: