-
Notifications
You must be signed in to change notification settings - Fork 104
Add user context to library #206
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
Conversation
Another option is to add virtual destructor to the |
Hi Alon (@alonbl ), This is a really nice Pull Request - thank you. We started using I'm going to point this at the release_candidate branch and run the workflow on it, just to make sure there are no hidden surprises. Do you have time to update Example2, showing how that can take advantage of the new methods? Thanks again, |
Hi @PaulZC , Thank you for the fast response :) Sure I will update the example. Will you prefer this method or adding virtual destractor? I mean, is there a reason why we do not allow inheritance? Alon |
Hi Alon, I think I prefer the user context over the virtual destructor... It seems clear and straightforward to me. I don't think other users will have any problem understanding it or using it. Best wishes, |
OK, just in case, please review[1] which is the virtual alternative. [1] #207 |
The current overwrite method of weak pointer is a global overwrite. As class is not polymorphic type (aka the overwrite enabled methods are weak instead of virtual) and there is no vtable as none of the methods are virtual, there is no way to have instance specific overwrite. A user context will provide a method to call back into a context of a parent class and resolve the issue without making the class polymorphic. Signed-off-by: Alon Bar-Lev <[email protected]>
The current overwrite method of weak pointer is a global overwrite. As class is not polymorphic type (aka the overwrite enabled methods are weak instead of virtual) and there is no vtable as none of the methods are virtual, there is no way to have instance specific overwrite.
A user context will provide a method to call back into a context of a parent class and resolve the issue without making the class polymorphic.
For example: