-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add length check guards for delete methods #31
Add length check guards for delete methods #31
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #31 +/- ##
=======================================
Coverage 97.50% 97.50%
=======================================
Files 2 2
Lines 120 120
=======================================
Hits 117 117
Misses 3 3 ☔ View full report in Codecov by Sentry. |
maybe a possible problem is that it deletes also the user-defined ones if I'm not mistaken, which can be an unwanted side effect in some cases |
Hm. Maybe the safest solution is to store the method objects that we create in thread-safe global storage, check if they still exist upon redefinition, and if so delete them? (To also avoid relying on any assumed orderings of |
I hope there's a simpler solution though 🙂 for this PR it could probably already be an improvement to just guard the original delete method calls with checks that they exist, but keep the assumption about the ordering |
Also your second solution seems like a good one to me, even if the first is safer. So I would say: let's go with it in this pr :-) |
Maybe we can create an issue saying that relying on the ordering of the methods table is not good practice, and so it should be changed in the future? |
6dc0499
to
29be0e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve, but I don't have merge privileges so we need to wait for merging it
I'd like to hold this PR for a little bit to investigate the behaviour with |
df875e2
into
BeastyBlacksmith:master
I merged this, since irrespective of Revise this fixes the 0-field to non 0-field struct error, I put in the tests |
This fixed #13 for me.
It seems like a safe solution, since there's no harm in deleting all existing methods that may be around as they will all be redefined subsequently -- but let me know if you foresee any issues.Update; the PR now just adds length check guards, which should be an improvement over the previous behaviour although an issue should be created for the assumption on index 1 and 2