-
Notifications
You must be signed in to change notification settings - Fork 3
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
Cool idea! #2
Comments
That's funny, I just committed to a new branch that does the same mutable
|
Hey guys! Wouldn't it be better just to deny in any direct set operations? I mean, this code should throw a
What do you think? |
I agree - that's why the abstraction is incomplete. Keep in mind that since JS does not have operator overloading, the above is actually impossible to implement without a macro or some other language extension. If you are OK with a less specific error message, you can implement your TypeError without Proxies: const map = Object.freeze(new Immutable.Map)
map[2] = 3 // Error! |
That would actually be a good idea! I am up for changing it to throw an On Mon, Sep 12, 2016 at 1:44 PM Boris Cherny notifications@github.com
|
Hey there!
I had a similar idea a while ago, but realized that without operator overloading this isn't a complete abstraction. Eg.
If we had operator overloading, we could do this, though it feels strange in JS:
Anyway, I ended up with this proof of concept: https://github.com/bcherny/auditable - mutable datatypes, backed by immutable data structures.
The text was updated successfully, but these errors were encountered: