Skip to content

Match typed arguments by type regardless of position#36

Open
alganet wants to merge 1 commit into
mainfrom
typed-unposition
Open

Match typed arguments by type regardless of position#36
alganet wants to merge 1 commit into
mainfrom
typed-unposition

Conversation

@alganet

@alganet alganet commented Jun 28, 2026

Copy link
Copy Markdown
Member

resolve() now binds typed parameters in a first pass: a positional object is claimed by the parameter declaring its type wherever it appears, so a leading untyped (scalar) parameter can no longer consume an object meant for a typed parameter declared after it. Untyped parameters then take the remaining positional arguments in declaration order.

Add tests for out-of-order typed matching and update the README resolution order and a type-first example accordingly.


This restores an old behavior with a small perf cost (two pass scan) that should be mild under a small number of arguments.

Tested with Config/Rest/Validation to ensure they still work cleanly.

This is a soft BC break (where before, an error would appear, now it might pass) but I would say anyone relying on that behavior was relying on unspecified behavior and therefore there's no actual BC break.

resolve() now binds typed parameters in a first pass: a positional object is
claimed by the parameter declaring its type wherever it appears, so a leading
untyped (scalar) parameter can no longer consume an object meant for a typed
parameter declared after it. Untyped parameters then take the remaining
positional arguments in declaration order.

Add tests for out-of-order typed matching and update the README resolution
order and a type-first example accordingly.
@alganet alganet requested a review from henriquemoody June 28, 2026 18:50
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