Skip to content

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

Open
@zoffixznet

Description

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.

Metadata

Assignees

No one assigned

    Labels

    data typesArrays, lists, hashes, pair objects, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions