FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Allow no-arg and chained Proc#refined and copy the block lazily by shugo · Pull Request #9555 · jruby/jruby · GitHub

/ jruby Public

Allow no-arg and chained Proc#refined and copy the block lazily - #9555

Open
shugo wants to merge 2 commits into
jruby:ruby-4.1from
shugo:feature/composable-proc-refined
Open

Allow no-arg and chained Proc#refined and copy the block lazily#9555
shugo wants to merge 2 commits into
jruby:ruby-4.1from
shugo:feature/composable-proc-refined

Conversation

shugo commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Since prc.refined(*ms).refined(*ns) is behaviorally equivalent to prc.refined(*ms, *ns), a chained call re-clones from the original closure with the merged module list and the memoized copy is shared by these behaviorally equivalent Procs. The copy of the block's IR is deferred until the first call, so a Proc that is never called is no longer copied at all.
(https://bugs.ruby-lang.org/issues/22213, ruby/ruby d4a6282429)

headius commented Aug 6, 2026

Copy link
Copy Markdown
Member

@shugo Let me know if you need assistance here.

shugo commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@shugo Let me know if you need assistance here.

Thank you!

[Feature #22213] has been accepted by Matz, so I'd like to squash the commits in this branch and make this pull request ready for review.
However, #9556 doesn't seem to have been merged into the ruby-4.1 branch yet.
Could you merge it?

shugo and others added 2 commits August 9, 2026 18:59
Proc#hash was missing, so procs that are eql? (e.g. a proc and its
dup) hashed differently.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Since prc.refined(*ms).refined(*ns) is behaviorally equivalent to
prc.refined(*ms, *ns), a chained call re-clones from the original
closure with the merged module list and the memoized copy is shared
by these behaviorally equivalent Procs.  The copy of the block's IR
is deferred until the first call, so a Proc that is never called is
no longer copied at all.  [Feature #22213]

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
shugo force-pushed the feature/composable-proc-refined branch from 80b9177 to 0b9fad0 Compare August 9, 2026 10:02
shugo marked this pull request as ready for review August 9, 2026 10:04
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL