Repository navigation
Build param defaults and custom type coercions from frozen objects - #3097
Merged
Merged
Conversation
ericproulx
force-pushed
the
refactor/defaults-coercers-without-procs
branch
from
November 21, 2026 17:17
48937fd to
068b639
Compare
This was referenced Nov 21, 2026
ericproulx
force-pushed
the
refactor/defaults-coercers-without-procs
branch
4 times, most recently
from
November 21, 2026 17:44
f32092a to
de5911e
Compare
DefaultValidator and CustomTypeCoercer built procs whose self was the validator or the coercer, closing over the default or the coercion method, so a compiled API holding one could not be frozen all the way down. They build small Data objects answering call instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
force-pushed
the
refactor/defaults-coercers-without-procs
branch
from
November 21, 2026 17:44
de5911e to
21ae0f5
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 #3096 and #3098.DefaultValidatorandCustomTypeCoercerbuilt procs whoseselfwas the validator or the coercer, closing over the default or the coercion method.Ractor.make_shareablerefuses such a proc, so a compiled API declaring adefault:, acoerce_with:or a custom type withoutparsed?could not be made shareable. They now build smallDataobjects answeringcall. A deep freeze reaches an object's fields in whatever order it walks, while a proc's captured values have to be shareable already.DefaultValidatorproc { options },proc { options.dup },proc { options.call }Value,Copy,DeferredCustomTypeCoerceris_a?or an Enumerable typeHashSymbolizer,CollectionSymbolizer,InstanceCheck,EnumerableCheckA default lambda taking the params, and a
coerce_with:lambda, are the user's own and stay as given. One written inside aparamsblock has theParamsScopeas itsself; that is for #2978.Throughput
Ruby 4.0.6, 6 rounds from one checkout, alternating which side runs first, median of the per-round ratios, measured with the change this was split from. Within noise:
Hash,Array[Integer]withcoerce_with:, a custom type)[], a value, a lambda)🤖 Generated with Claude Code