-
Notifications
You must be signed in to change notification settings - Fork 16
Difference with Object.freeze #4
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
Comments
A couple of things from my understanding (might be wrong), mostly assuming the implementation in JS engines would be something like Immutablejs. There are probably more reasons that I'm unaware of.
vs
|
@jmorrell this would be a significant departure from the way javascript preforms equality checks. The behavior should be the same for mutable and immutable reference types. ie. let a = [1, 2]
let b = [1, 2]
a == a // true
b == b // true
a == b // false
let c = #[1, 2]
let d = #[1, 2]
c == c // true
d == d // true
c == d // false the only way to have the behavior you want is to use singletons under the hood. ie. when declaring |
Can you explain: how new record:
is different from:
?
And how new tuple:
is different from this:
?
If they're not deep immutable, it's looks like there are no differences. I suspect new types have some performance gains, but don't understand how it can be achieved.
The text was updated successfully, but these errors were encountered: