Skip to content

Commit e08820a

Browse files
committed
Make descriptions of .list/.hash more precise
- Only *core* Positional/Associative types can be returned: Closes rakudo/rakudo#2199 R#2199 - Fix up remaining POD errors - Reduce prose on .hash and make it more equivalent to that on .list
1 parent 8591eff commit e08820a

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

doc/Type/Any.pod6

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ Defined as:
8888
multi method list(Any:D \SELF: --> List)
8989
9090
91-
Applies the infix L«C<,>|/routine/,»
92-
operator to the invocant
93-
and returns the resulting L<List>:
91+
Applies the infix L«C<,>|/routine/,» operator to the invocant and returns
92+
the resulting L<List>:
9493
9594
say 42.list.^name; # OUTPUT: «List␤»
9695
say 42.list.elems; # OUTPUT: «1␤»
9796
98-
Subclasses of C<Any> may choose to return any L<Positional> type
99-
from L«C<.list>|/routine/list>». Use L«C<.List>|/routine/List> to
97+
Subclasses of C<Any> may choose to return any I<core> type that
98+
does the L<Positional> role
99+
from L«C<.list>|/routine/list». Use L«C<.List>|/routine/List» to
100100
coerce specifically to L<List>.
101101
102102
=head2 method push
@@ -377,15 +377,13 @@ Defined as:
377377
multi method hash(Any:U: --> Hash:D)
378378
multi method hash(Any:D: --> Hash:D)
379379
380-
Coerces a type object to an empty L<Hash>.
380+
When called on a type object, returns an empty L<Hash>. On instances,
381+
equivalent to assigning the the invocant to a C<%->sigilled variable and
382+
returning that.
381383
382-
More generally, coerces a defined invocant to something that supports the
383-
L<Associative> role. This may be a mutable L<Hash>, but may also be
384-
an immutable L<Map> or anything else that supports the L<Associative>
385-
role. Use the C<.Hash> method if you really want to have a mutable L<Hash>,
386-
or the C<.Map> coercer if you're happy enough with an immutable L<Map>.
387-
Use the C<.hash> coercer if you really don't care and want the cheapest
388-
way to get an object that does the L<Associative> role.
384+
Subclasses of C<Any> may choose to return any I<core> type that does the
385+
L<Associative> role from L«C<.hash>|/routine/hash». Use L«C<.Hash>|/routine/Hash» to
386+
coerce specifically to L<Hash>.
389387
390388
=begin code
391389
my $d; # $d is Any

0 commit comments

Comments
 (0)