Closed holyjak closed 8 years ago
Love it, thanks @jakubholynet !
Along those lines, I am confused. The production version seems to me that it effectively leaves objects immutable, which invalidates the concept of this library. I understand that the production version is useful when performance is a problem, but from what I can tell it stops delivering making objects immutable.
I could be missing something fundamental.
@InsomniacFury Correct - the production build does not make objects immutable.
The idea is that in development you will have used the immutable guarantees to end up with code that does not mutate anything, and by the time you reach production, the guarantees are implicit by the code you've written, and no longer need to be enforced.
If you want stronger guarantees in production, there's absolutely no reason you can't keep using the dev build. In fact, when the library was first released, the dev build was all there was! :smiley:
@rtfeldman thanks for the response. That makes sense. I saw that in the docs Safari was called out as having a slow Object.freeze(). Are there any other performance implications that has lead to the production version not enforcing the immutability?
@InsomniacFury Just that it does extra work on instantiation - namely freezing and banning methods.
It should be stated what build is used by default and provide a justification for it. A newcomer would be likely confused by why we use dev build in production, so I have copied the justification from #50 and referred to it regarding info about how to switch. I suppose this is going to evolve but we should document the current status.