Hacker News new | ask | show | jobs
by dsp1234 3748 days ago
I wonder if that's a problem with stuff like immutibleJS since the object itself is permanently mutated as part of being added to the set.

Also, if this was being done for ES5+ code, then either setting that property to non-enumerable or using something like Symbols would be cool since it would hopefully have a reduced impact on other code.

1 comments

Depending on the implementation, yup. Since both of the most popular Immutable libraries that I know of (Immutable.js, mori) have their own API for setting properties via a `.set` method, it would not be unreasonable for them to use `Object.freeze` in order to make raw mutations throw an error.

Both libraries provide their own implementation of a Set though, so in practice you would just use the library provided one.