-
Notifications
You must be signed in to change notification settings - Fork 14
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
Removing elements from a mutable red-black tree affects its immutable clones #47
Comments
Ah, sorry yeah the documentation doesn't exist yet so I admit there's a little trial and error you have to go through at the moment. The gotcha in this case is that cloning from mutable to immutable is an unsafe operation. Safe cloning must always be performed from an immutable source. What you need to do is perform any mutations you care about, then commit (formerly "freeze") the changes. To perform further mutations, create a mutable clone thereof. The methods you want are Take a look at the jsdoc comments for mutation.ts in frptools/core. The main points are:
As I said, take a look at |
I see, thanks for clarifying. Closing this issue since it's not a bug. |
Using current master (84d7bdb):
Expected output:
Actual output:
I encountered this when I tried to use an immutable clone for stable iterators in #44 (comment). I think I'm using the new API correctly (
freeze
/thaw
seem to have been removed), but let me know if I'm misunderstanding how it's supposed to work.The text was updated successfully, but these errors were encountered: