Skip to content

Stop loading Kernel#with by default - #333

Merged
trans merged 1 commit into
mainfrom
claude/github-connector-capabilities-4qcre6
Sep 27, 2026
Merged

trans merged 1 commit into
mainfrom
claude/github-connector-capabilities-4qcre6

Conversation

@trans

@trans trans commented Sep 27, 2026

Copy link
Copy Markdown
Member

Fixes #290.

A global Kernel#with breaks other libraries' methods of that name, such as RSpec's receive(...).with(1, anything, /bar/) (#290) and Rails 7.1's Object#with. It was already deprecated in #331, but require '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.rb stays in lib/core.
  • It's commented out of facets/kernel.rb with # uncommon.
  • It's tagged @uncommon with its require line.

require 'facets/kernel/with' still provides it, deprecated, until its removal after 2027-09-30.

Breaking

Code that calls with after only require 'facets' will now get NoMethodError. The fix is obj.instance_eval { ... }, or requiring the file explicitly. This is listed under Breaking in HISTORY.md.

Testing

  • The only change in what require 'facets' defines is Kernel#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

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
@trans
trans merged commit d59ba78 into main Sep 27, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Global definition of 'with' function in Kernel module breaks rspec functionality

2 participants