Repository navigation
Define Grape's callable constants as modules rather than lambdas - #3096
Merged
Merged
Conversation
ericproulx
force-pushed
the
refactor/callable-constants-as-modules
branch
from
November 21, 2026 17:16
a378705 to
dc9a343
Compare
This was referenced Nov 21, 2026
ericproulx
force-pushed
the
refactor/callable-constants-as-modules
branch
from
November 21, 2026 17:24
dc9a343 to
3332406
Compare
A proc carries the self it was written under and the variables it closes over, so freezing one does not make it shareable; a module is shareable as it is. DEFAULT_LAMBDA_FORMATTER, FORWARD_MATCH_METHOD, NON_FORWARD_MATCH_METHOD and RUN_ENDPOINT become modules answering call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
force-pushed
the
refactor/callable-constants-as-modules
branch
from
November 21, 2026 17:29
3332406 to
6fe8e0a
Compare
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.
Part of making Grape's internals readable from a non-main Ractor, without calling the
RactorAPI fromlib/(groundwork for #2978). Split from #3095, with the rest in #3097 and #3098.A proc carries the
selfit was written under and the variables it closes over, so freezing one does not let a non-main Ractor call it: onlyRactor.make_shareabledoes that. A module is shareable as it is. The four lambda constants become modules answeringcall, the shape of the formatters Grape registers:Grape::Formatter::DEFAULT_LAMBDA_FORMATTER. A format nothing is registered for raised in a Ractor.Grape::Router::Route::FORWARD_MATCH_METHODandNON_FORWARD_MATCH_METHOD.Grape::Endpoint::RackStack::RUN_ENDPOINT, private, nowRunEndpoint.The public ones keep their names, and their callers only ever
callthem.Throughput
Ruby 4.0.6, 6 rounds from one checkout, alternating which side runs first, median of the per-round ratios. Route matching now calls a module rather than a lambda:
🤖 Generated with Claude Code