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

Inconsistency: can bind wrong type to typed Hash but not typed Array's value #1655

Open
zoffixznet opened this issue Mar 26, 2018 · 0 comments
Labels
data types Arrays, lists, hashes, pair objects, etc.

Comments

@zoffixznet
Copy link
Contributor

Not sure which way is right or desirable, but if possible would be good to have a consistency between the two:

19:32 |   | m: my Int %h; %h<foo> := rand; dd %h
-- | -- | --
19:32 | camelia | rakudo-moar 1c4eebe52: OUTPUT: «Hash[Int] %h = (my Int % = :foo(0.9608381618766769e0))␤»
19:32 | Zoffix | m: my Int @h; @h[2] := rand;
19:32 | camelia | rakudo-moar 1c4eebe52: OUTPUT: «Cannot resolve caller BIND-POS(Array[Int]: Int, Num); none of these signatures match:␤    (Array:D $: int $pos, Int \bindval, *%_)␤    (Array:D $: Int:D $pos, Int \bindval, *%_)␤  in block <unit> at <tmp> line 1␤␤»

You can re-bind a non-Int to Int-parametarized Hash, but you can't do the same with Arrays because BIND-POS is typed to parametarized type.

@lucasbuchala lucasbuchala added the data types Arrays, lists, hashes, pair objects, etc. label Mar 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data types Arrays, lists, hashes, pair objects, etc.
Projects
None yet
Development

No branches or pull requests

2 participants