On 10/13/25 1:04 AM, Elizabeth Mattijsen wrote:
On 13 Oct 2025, at 09:13, ToddAndMargo via perl6-users <[email protected]>
wrote:
what am I doing wrong this time?
$ raku -e 'say &?ROUTINE.gist;'
===SORRY!=== Error while compiling -e
Undeclared name:
?ROUTINE used at line 1. Did you mean 'Routine'?
Your in confusion,
&?ROUTINE is only set *inside* a subroutine or a method. So it can't find
&?ROUTINE, and then falls back to the normal error that you get when referencing an
unknown subroutine (taking the `&` off of the full name of the subroutine), e.g:
$ raku -e 'foo'
===SORRY!=== Error while compiling -e
Undeclared routine:
foo used at line 1
The error message is indeed a bit confusing in the &?ROUTINE context.
That explains it. I copies it out of
sub MyName( $LongSubName ) {
# $LongSubName is &?ROUTINE.gist from the calling routine
&?ROUTINE.gist ~~ m/' '(.*?)' '\(/;
my $SubName = $0;
return $SubName;
}
Thank you!