Repository navigation
Stop loading Kernel#with by default - #333
Merged
Merged
Conversation
A global Kernel#with breaks other libraries' methods of that name, such as RSpec's receive(...).with (#290) and Rails 7.1's Object#with. It was already deprecated; now `require 'facets'` no longer loads it either. Following the existing convention for uncommon methods, it stays in lib/core, is commented out of facets/kernel.rb, and is tagged @Uncommon. `require 'facets/kernel/with'` still provides it until its removal after 2027-09-30. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E2Njj4j1r9twkVcXsMySLW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #290.
A global
Kernel#withbreaks other libraries' methods of that name, such as RSpec'sreceive(...).with(1, anything, /bar/)(#290) and Rails 7.1'sObject#with. It was already deprecated in #331, butrequire 'facets'still loaded it, so those users stayed broken until its removal.Change
This follows the existing convention for uncommon methods (
mattr,file/atomic_write,kernel/memo, …):kernel/with.rbstays inlib/core.facets/kernel.rbwith# uncommon.@uncommonwith its require line.require 'facets/kernel/with'still provides it, deprecated, until its removal after 2027-09-30.Breaking
Code that calls
withafter onlyrequire 'facets'will now getNoMethodError. The fix isobj.instance_eval { ... }, or requiring the file explicitly. This is listed under Breaking inHISTORY.md.Testing
require 'facets'defines isKernel#with. I compared the full method list before and after.rake test: 1,263 tests pass on CRuby 3.3 and on JRuby 10.1.2 (4 pending).rake qed: 157 demos pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01E2Njj4j1r9twkVcXsMySLW
Generated by Claude Code