Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
KamilaBorowska opened this issue Jan 28, 2013 · 0 comments
Open

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

KamilaBorowska opened this issue Jan 28, 2013 · 0 comments

Comments

@KamilaBorowska
Copy link

@ 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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant