-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
js: Adding manual release methods #7428
Conversation
You'll need to pass |
Good catch. |
Looks good. It would kind of be nice to be defensive against the user calling |
Yeah was considering that, could be done storing a Boolean on the objects. I think what would make sense design wise is make a super class that provides the registration and release of the reference, that super class can then be providing that Boolean flag, and assertion function without it having to be implemented on all class implementations. The child classes just have to provide the increase and decrease functions to the super constructor. |
That would work, but the standard practice here is to set
Eh... you still need to call the assertion function in every method on every class, so having the actual implementation be in a superclass doesn't buy you much (vs just having a top-level |
I'm going to limit the scope to just adding One big downside of doing this is that its a breaking change type wise to the library. Any usage of the library that references |
Sound fine. I wouldn't worry too much about making |
Ok, assertion added, i think this solution with an internal |
Adding methods allowing manual reference cleanup of object created by high level api.
I was considering if it instead should be called decRef like the native api, and java api is called. https://github.com/Z3Prover/z3/blob/master/src/api/java/Solver.java#L418, or if it should be called something more intuitive to a javascript developer, for whom the concept of references is abstracted away. My suggestion in this pr is the latter.
Also considering if we want to add runtime checks that asserts no methods can be called on objects that are released.
Fixes #7427
@bakkot