Skip to content

rename all closures to more closely match a name you can read vs CLOSURE_2#8203

Merged
enebo merged 4 commits intojruby:masterfrom
enebo:ir2
Apr 19, 2024
Merged

rename all closures to more closely match a name you can read vs CLOSURE_2#8203
enebo merged 4 commits intojruby:masterfrom
enebo:ir2

Conversation

@enebo
Copy link
Member

@enebo enebo commented Apr 18, 2024

Allow closures names of scopes to be more readable:

retriable::CLOSURE_1::CLOSURE2 now looks like retriable::times &|index|2::any? &|e|4

Literal lambdas also print out with ->(a)1.

@enebo enebo added this to the JRuby 9.4.7.0 milestone Apr 18, 2024
enebo added 3 commits April 19, 2024 10:23
This will make scope names much easier to glance at to know what they
are.  This also corrects line number from 0-based to 1-based.

CLOSURE_1::CLOSURE_2 is just not super easy to grok.  This new form
will make the closure a combination of the method name using the closure
along with the closure parameters.  For raw lambdas the name will be
->({vars})_{id}.

We still emit closure id onto end of the new name since we can still have
identical closure strings.
@enebo enebo changed the title syntactical lambdas can use their own name for closure prefix rename all closures to more closely match a name you can read vs CLOSURE_2 Apr 19, 2024
@enebo enebo merged commit 7254a4a into jruby:master Apr 19, 2024
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.

1 participant