Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dispatch disambiguation for 'is item'
This allows for multi routines to distinguish between itemized arguments. For the sake of simplicity, the parameter trait does not add any new ParamTypeChecks to the parameter. Instead it is only used as a marker for disambiguation in multiple dispatch: multi sub a(@A is item) { "itemized!" } multi sub a(@A) { "array" } a [1,2]; # "array" a $[1,2]; # "itemized!" This also works for associatives (${} / {}) and lists ($() / ()). Sigil-less parameters with Associative or Positional types can also be disambiguated by 'is item'. It also works on named parameters. Note that nested-parameters are currently not parsing with traits at the moment. When they do, this code will require some adjustment as currently we only use one name in our name-to-type lookup. Since there was no way to test that it would work, it has been left for later.
- Loading branch information
Showing
2 changed files
with
166 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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