Hi Brian, On 24.01.2017 23:28, Brian Duggan wrote: > Hi All, > > This code: > > my $str = ''; > class Mock { > method say($arg) { $str ~= $arg } > } > $*OUT = Mock.new; > say 'hi'; > > produces: > > Too many positionals passed; expected 1 argument but got 2 > in block <unit> at out.p6 line 6 > > Changing the signature of say doesn't seem to help. > > If I change 'say' to 'print' in Mock, things work > fine, though I'm having a hard time figuring out why > the code above doesn't work. Any ideas?
Because say() is a high-level function that uses the lower-level $*OUT.print under the hood. >From rakudo's src/core/io_operators.pm: multi sub say(Str:D \x) { my $out := $*OUT; $out.print(nqp::concat(nqp::unbox_s(x),$out.nl-out)); } You might be interested in https://perlgeek.de/blog-en/perl-6/2016-book-testing-say.html :-) Cheers, Moritz -- Moritz Lenz https://deploybook.com/ -- https://perlgeek.de/ -- https://perl6.org/