Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =head2 method keyof
- Defined as:
- method keyof
- Usage:
- Hash.keyof
- Returns the type constraint for the keys of the invocant. For
- normal hashes the method returns the coercion type C<(Str(Any))>
- while for L<object hashes|/type/Hash#Object_hashes_and_type_constraints>
- the type used in the declaration of the C<Hash> is returned.
- my %h1 = 'apples' => 3, 'oranges' => 7; # (no key type specified)
- say %h1.keyof; # (Any)
- my %h2{Str} = 'oranges' => 7; # (keys must be of type C<Str>)
- say %h2.keyof; # (Str)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement