Skip to content

Commit

Permalink
Make descriptions of .list/.hash more precise
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
zoffixznet committed Aug 10, 2018
1 parent 8591eff commit e08820a
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions doc/Type/Any.pod6
Expand Up @@ -88,15 +88,15 @@ Defined as:
multi method list(Any:D \SELF: --> List)
Applies the infix L«C<,>|/routine/,»
operator to the invocant
and returns the resulting L<List>:
Applies the infix L«C<,>|/routine/,» operator to the invocant and returns
the resulting L<List>:
say 42.list.^name; # OUTPUT: «List␤»
say 42.list.elems; # OUTPUT: «1␤»
Subclasses of C<Any> may choose to return any L<Positional> type
from L«C<.list>|/routine/list>». Use L«C<.List>|/routine/List> to
Subclasses of C<Any> may choose to return any I<core> type that
does the L<Positional> role
from L«C<.list>|/routine/list». Use L«C<.List>|/routine/List» to
coerce specifically to L<List>.
=head2 method push
Expand Down Expand Up @@ -377,15 +377,13 @@ Defined as:
multi method hash(Any:U: --> Hash:D)
multi method hash(Any:D: --> Hash:D)
Coerces a type object to an empty L<Hash>.
When called on a type object, returns an empty L<Hash>. On instances,
equivalent to assigning the the invocant to a C<%->sigilled variable and
returning that.
More generally, coerces a defined invocant to something that supports the
L<Associative> role. This may be a mutable L<Hash>, but may also be
an immutable L<Map> or anything else that supports the L<Associative>
role. Use the C<.Hash> method if you really want to have a mutable L<Hash>,
or the C<.Map> coercer if you're happy enough with an immutable L<Map>.
Use the C<.hash> coercer if you really don't care and want the cheapest
way to get an object that does the L<Associative> role.
Subclasses of C<Any> may choose to return any I<core> type that does the
L<Associative> role from L«C<.hash>|/routine/hash». Use L«C<.Hash>|/routine/Hash» to
coerce specifically to L<Hash>.
=begin code
my $d; # $d is Any
Expand Down

0 comments on commit e08820a

Please sign in to comment.