Conversation
The multi dispatch candidate filter requires a native value or a
native container for a natively typed parameter. The binder is less
strict. It unboxes a boxed value into the same parameter for a
non-multi routine and for a named parameter. A call such as bar("f")
against a lone (str $s) candidate could therefore only dispatch when
the optimizer settled the call at compile time and skipped the
filter. Whether that happened depended on the candidate body being
inlinable and on the shape of the call site. The same call worked at
the top level and failed inside a loop body. It always failed for
method multis and at lower optimization levels. "Give a paired
literal its native representation" then made a lone literal dispatch
as the boxed value it is, so such a call failed everywhere. Failing
consistently still leaves the multi form rejecting a value the
equivalent sub form binds.
The dispatcher now sets aside a candidate whose only obstacle is a
native parameter facing a concrete value of the native box type.
When no candidate is in the running otherwise, those candidates are
tried in order with a bind check deciding each. Within a tied group
that order is the candidate order, as it is for constrained
candidates on the normal path. A dispatch that resolves today keeps
its candidate. The retry only exists on calls that otherwise fail,
carries its bind check at run time, and is never settled at compile
time. A parameter marked rw stays native container only. A boxed
integer against an int and Int pair keeps choosing Int, and a native
container keeps choosing the native candidate. find_best_dispatchee
applies the same rule with the same gating, including the named
argument admission the dispatch plan applies. A trial bind that
throws counts as not bindable there instead of leaking a VM error
out of introspection.
The compile time analysis judges an object argument against a native
parameter by the same relation. A Str argument to a lone int
candidate is still refused at compile time. An Int argument to a
lone uint candidate no longer is. Both frontends judge a multi with
the reading the call site passes and keep the native reading of a
lone literal for the proto trial bind.
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.
The multi dispatch candidate filter requires a native value or a native container for a natively typed parameter. The binder is less strict. It unboxes a boxed value into the same parameter for a non-multi routine and for a named parameter. A call such as bar("f") against a lone (str $s) candidate could therefore only dispatch when the optimizer settled the call at compile time and skipped the filter. Whether that happened depended on the candidate body being inlinable and on the shape of the call site. The same call worked at the top level and failed inside a loop body. It always failed for method multis and at lower optimization levels. "Give a paired literal its native representation" then made a lone literal dispatch as the boxed value it is, so such a call failed everywhere. Failing consistently still leaves the multi form rejecting a value the equivalent sub form binds.
The dispatcher now sets aside a candidate whose only obstacle is a native parameter facing a concrete value of the native box type. When no candidate is in the running otherwise, those candidates are tried in order with a bind check deciding each. Within a tied group that order is the candidate order, as it is for constrained candidates on the normal path. A dispatch that resolves today keeps its candidate. The retry only exists on calls that otherwise fail, carries its bind check at run time, and is never settled at compile time. A parameter marked rw stays native container only. A boxed integer against an int and Int pair keeps choosing Int, and a native container keeps choosing the native candidate. find_best_dispatchee applies the same rule with the same gating, including the named argument admission the dispatch plan applies. A trial bind that throws counts as not bindable there instead of leaking a VM error out of introspection.
The compile time analysis judges an object argument against a native parameter by the same relation. A Str argument to a lone int candidate is still refused at compile time. An Int argument to a lone uint candidate no longer is. Both frontends judge a multi with the reading the call site passes and keep the native reading of a lone literal for the proto trial bind.