Re: sub name has unexpected interaction with s///

2018-10-23 Thread Timo Paulssen
Hi Richard, I wouldn't call s/// a routine. It's actually (implemented as) a kind of quote, like Q, q, qq, qw, and also rx, and tr. I consider that an important distinction, because the syntax with which you call s/// is very different from how you call a sub. You can't just `say '(' ~ ')' 1234`,

Re: sub name has unexpected interaction with s///

2018-10-22 Thread Richard Hainsworth
Short answer: Yes. Longer: Perl 6 allows you to over-ride the names of routines. 's' is a routine. You over-rode it. Perl 6 is different from most other languages because it uses multiple dispatch. Effectively this means it is not just the name of the subroutine (s) that matters, but also it

sub name has unexpected interaction with s///

2018-10-22 Thread Richard Hogaboom
The following code: use v6; my $str = 'abc'; sub s {1}; say s; $str ~~ s:g/ b /x/; dd $str; say $/; outputs: 1 Str $str = "axc" (「b」) as expected. But, just remove the :g global flag and: ===SORRY!=== Error while compiling /home/hogaboom/hogaboom/Perl6/p6ex/./t.p6 Undeclared routine: