Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added docs for method of in class Hash and removed som trailing space…
…s. rindolf++
  • Loading branch information
Jan-Olof Hendig committed May 28, 2016
1 parent 5b29667 commit 7e63db0
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions doc/Type/Hash.pod
Expand Up @@ -326,10 +326,10 @@ Usage:
Hash.default
Returns the default value of the invocant, i.e. the value which is returned
Returns the default value of the invocant, i.e. the value which is returned
when a non existing key is used to access an element in the C<Hash>.
Unless the C<Hash> is declared as having a default value by using the
L<is default|/routine/is default> trait the method returns the type object
Unless the C<Hash> is declared as having a default value by using the
L<is default|/routine/is default> trait the method returns the type object
C<(Any)>.
my %h1 = 'apples' => 3, 'oranges' => 7;
Expand All @@ -350,7 +350,7 @@ Usage:
Hash.keyof
Returns the type constraint for the keys of the invocant. For
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.
Expand All @@ -362,6 +362,26 @@ the type used in the declaration of the C<Hash> is returned.
say %h2.keyof; # (Str)
%h2{3} = 'apples'; # throws exception of type X::TypeCheck::Binding
=head2 method of
Defined as:
method of
Usage:
Hash.of
Returns the type constraint for the values of the invocant. By default,
i.e. if no type constraint is given during declaration, the method
returns C<(Mu)>.
my %h1 = 'apples' => 3, 'oranges' => 7; # (no type constraint specified)
say %h1.of; # (Mu)
my Int %h2 = 'oranges' => 7; # (values must be of type Int)
say %h2.of; # (Int)
=head1 Subscript Adverbs
Some methods are implemented as adverbs on subscripts.
Expand Down

0 comments on commit 7e63db0

Please sign in to comment.