-
-
Notifications
You must be signed in to change notification settings - Fork 852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify that the first result from the producer is not immutable unless a change is made #412
Clarify that the first result from the producer is not immutable unless a change is made #412
Comments
Immer is a great and convenient structure-sharing system, but does not confer immutability except at points of change. Here's another example that illustrates this:
|
Although the freezing itself is not really the point of immer (there are separate packages for that), it seems a lot of peepz expect a full freeze from immer. To avoid more confusion in the future, a PR is welcome :) |
I'm happy to (recursively) pre-freeze. Is it worth mentioning your favourite one in the docs, near the start to ensure immutability? I'll be more than satisfied with that. |
A PR is welcome, but not urgent, I hope to get around to implement the change anyway in a couple of weeks, as it would be the least suprising behavior it seems in general :) |
@mweststrate can you clarify what change you're thinking of making? I also expected that |
The first 😊
Op ma 9 sep. 2019 23:16 schreef Ian Storm Taylor <[email protected]>:
… @mweststrate <https://github.com/mweststrate> can you clarify what change
you're thinking of making? I also expected that produce always returns
deeply frozen objects. Are you thinking of changing to make that so? Or
just changing the docs to have a warning?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#412?email_source=notifications&email_token=AAN4NBGWR6PD3B6GZYV4OUTQI3DKBA5CNFSM4IPIBQO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6JGPWQ#issuecomment-529688538>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAN4NBHQXW4GPQUCYUUUMQLQI3DKBANCNFSM4IPIBQOQ>
.
|
🎉 This issue has been resolved in version 4.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🚀 Feature Proposal
As expected, when the producer is first applied to an object (or array) and a change is made, an immutable object results. However, if no such change is made, the result is mutable.
Motivation
Docs are unclear on this matter. I suggest that it would be better to make the result immutable regardless. But if that doesn't work, it would be good for the docs to be clear on this matter.
With the current implementation, I'm forced to make an arbitrary change to the object to make sure that it is immutable immediately.
Example
The text was updated successfully, but these errors were encountered: