39 ms·
Alternatively, why not embrace immutability and add native immutable data structures to JS? I believe there is a TC39 proposal for this, in fact. Even if O.o ha
by msvan 11y ago
Alternatively, why not embrace immutability and add native immutable data structures to JS? I believe there is a TC39 proposal for this, in fact. Even if O.o had become mainstream, I would've stayed away from it. The immutability trend is not due to the impracticality of dealing with object observation, but due to inherent issues with mutable state.
- smasher164 11y agoHere's that proposal. https://github.com/sebmarkbage/ecmascript-immutable-data-structures https://github.com/sebmarkbage/ecmascript-immutable-data-str...
- bcherny 11y agoha! i actually commented on this guy a few months ago. javascript is designed in such a way that i think true, clojure-like immutable data structures are not possible. we'd either need to overload comparators (===, ==) so that they compare immutable data by value (rather than by reference, which is the case for their mutable counterparts), or implement java-style .equals methods for immutable objects (or as static methods on their constructors). neither seems to be a great fit for javascript. see my comment here https://github.com/sebmarkbage/ecmascript-immutable-data-structures/issues/4#issuecomment-99555565 https://github.com/sebmarkbage/ecmascript-immutable-data-str...