Skip to content

Commit 7b7de10

Browse files
committed
Make it clear what Any.hash does.
See issue #1731. As of source code in moar-2017.12.
1 parent eff7843 commit 7b7de10

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

doc/Type/Any.pod6

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,20 @@ Coerce the invocant to L<Hash>.
375375
376376
Defined as:
377377
378-
method hash(--> Hash:D) is nodal
378+
proto method hash(|) is nodal
379+
multi method hash(Any:U: --> Hash:D)
380+
multi method hash(Any:D: --> Hash:D)
379381
380-
Coerce the invocant to L<Hash>.
382+
Creates a new L<Hash|/type/Hash>, empty in the case the invocant is
383+
undefined, or coerces the invocant to an C<Hash> in the case it is
384+
defined.
385+
386+
=begin code
387+
my $d; # $d is Any
388+
say $d.hash; # OUTPUT: {}
389+
$d.append: 'a', 'b';
390+
say $d.hash; # OUTPUT: {a => b}
391+
=end code
381392
382393
=head2 method Slip
383394

0 commit comments

Comments
 (0)