- Notifications
You must be signed in to change notification settings - Fork 1.4k
MONGOID-5702: Monkey Patch Removal: Remove __numeric__ class method from Numeric module #5746
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
base: master
Are you sure you want to change the base?
Conversation
…dule. It is now inlined into its only usage. It was previously declared @api private so assume it is safe to delete.
This should be a straightforward merge. |
@johnnyshields thanks for this one, yeah, it should be totally safe to apply, thanks to that However, I feel like this is a step backward in readability. The
|
@jamis how so? The previous method was: def evolve(object) __evolve__(object) do |obj| __numeric__(obj) rescue obj # <-- this line is now inlined end end There is nothing particularly "readable" about the old method--by reading this, can anyone really tell me what
This PR is a stepping stone to putting |
@johnnyshields we'll have to agree to disagree, then. I find the original version infinitely more readable -- the intention is immediately apparent by glancing at the implementation. By inlining the implementation of I won't try to convince you, though; it's fine if you have a different opinion. But I'm not comfortable inlining the |
Readability is neither here nor there-- the goal of this PR is to get rid of monkey patches. It's far better to "unrefactor" to remove the monkey patches first, then the "re-refactor" them into a sustainable, non-monkey patched structure. If we don't take this approach, and puritanically insist that all methods be maximally readable at all times, we'll never actually get rid of our monkeys 🐒 🐒 🐒 Put another way, trading a slightly less-readable method for eliminating a monkey patch is a good trade--and is a two-way door. |
@johnnyshields -- we aren't going to agree on this. Ultimately, we do agree that the monkey-patches on core classes should be minimized. I suggested moving Regardless, inlining |
It is now inlined into its only usage. It was previously declared @api private so assume it is safe to delete.