method AT-KEY
1 | language documentation Subscripts |
1.1 | (Subscripts) method AT-KEY |
2 | role Associative |
2.1 | (Associative) method AT-KEY |
Documentation for method AT-KEY
assembled from the following types:
language documentation Subscripts
From Subscripts
(Subscripts) method AT-KEY
multi method AT-KEY (::?CLASS: )
Expected to return the element associated with $key
. This is what postcircumfix { }
normally calls.
If you want an element to be mutable (like they are for the built-in Hash type), you'll have to make sure to return it in the form of an item container that evaluates to the element's value when read, and updates it when assigned to. (Remember to use return-rw
or the is rw
routine trait to make that work; see the example.)
On the other hand if you want your collection to be read-only, feel free to return non-container values directly.
role Associative
From Associative
(Associative) method AT-KEY
method AT-KEY(\key)
Should return the value / container at the given key.