Skip to content

Commit bb92b0d

Browse files
committed
Clarifies say in Mu, closes #2619
1 parent c46235e commit bb92b0d

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

doc/Type/Mu.pod6

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,20 +425,27 @@ stringifying non-C<Str> object using the C<.Str> method.
425425
426426
=head2 method say
427427
428-
multi method say(--> Bool:D)
428+
multi method say()
429429
430430
Will L<C<say>|/type/IO::Handle#method_say> to
431431
L<standard output|/language/variables#index-entry-$*OUT>.
432-
To produce machine readable output use C<.put> instead.
433432
434433
say 42; # OUTPUT: «42␤»
435434
435+
What C<say> actually does is, thus, deferred to the actual subclass. In <most
436+
cases|/routine/say> it calls L<C<.gist>|/routine/gist> on the object, returning
437+
a compact string representation.
438+
436439
In non-sink context, C<say> will always return C<True>.
437440
438-
say (1,[1,2],"foo",Mu).map: so *.say ;# OUTPUT: «1␤[1 2]␤foo␤(Mu)␤(True True True True)␤»
441+
say (1,[1,2],"foo",Mu).map: so *.say ;
442+
# OUTPUT: «1␤[1 2]␤foo␤(Mu)␤(True True True True)␤»
443+
444+
However, this behavior is just conventional and you shouldn't trust on it for
445+
your code. It's useful, however, to explain certain behaviors.
439446
440-
C<say> is first printing out, but the outermost C<say> is printing the C<True>
441-
values returned by the C<so> operation.
447+
C<say> is first printing out in C<*.say>, but the outermost C<say> is printing
448+
the C<True> values returned by the C<so> operation.
442449
443450
=head2 method ACCEPTS
444451

0 commit comments

Comments
 (0)