-
Notifications
You must be signed in to change notification settings - Fork 8
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
Flag to indicate that the object is immutable #29
Comments
For the record, If an immutable object is passed back by library N, then querying it via a directly required instance of |
Why do you need this flag? |
To provide a slightly less duck-typy way to deal with mixed immutable and 'regular' objects - for instance, for a deep get that might (not decided yet) include both mutable and immutable objects: |
and, ofc, because npm breaks instanceof as a universal checker - as you demonstrated so amply before with your prototypes problem. |
Functions that deal with Avoid it if you can. |
You may well be right - still undecided on how deep operations should work. That said, sometimes important to know if something's claiming to be (for instance) a promise, or is some other type of return value. I think this flag will find its place in making it easy to reason about these objects 'in the wild' (when more than one lib exports them). I'll freely admit it's a slight API gamble; but erring slightly more on the side of making it easy for people to integrate into their daily lives doesn't seem like a step too far. |
I prefer |
Flag or function to show that an immutable value is immutable:
Suggestions:
Pros:
Cons:
Pros:
Cons:
The text was updated successfully, but these errors were encountered: