Skip to content
This repository

Multi dispatch ignores @, % and & type specifiers. #168

Open
xfix opened this Issue · 0 comments

1 participant

Konrad Borowski
Konrad Borowski

@ enforces Positional type, % enforces Associative type and & enforces Callable type. However, those type constaints are ignored when deciding which method should be multi dispatched to when having more than one such method.

niecza> multi a(@a) { 'array' }
sub a(@a) { ... }
niecza> multi a(%a) { 'hash' } 
sub a(%a) { ... }
niecza> multi a(&a) { 'sub' }
sub a(Any &a) { ... }
niecza> a [1, 2, 3]
array
niecza> a {a => 'b'}
hash
niecza> a {say 42}
sub
niecza> multi a($a) { 'scalar' }
sub a(Any $a) { ... }
niecza> a 'abc'
scalar
niecza> a [1, 2, 3]
scalar
niecza> a {a => 'b'}
scalar
niecza> a {say 42}
scalar
niecza>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.