You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<Zoffix> m: sub foo {}; my $x = foo // 'meow'
<camelia> rakudo-moar 29a110: OUTPUT«===SORRY!=== Error while compiling
<tmp>Null regex not allowedat <tmp>:1------> sub foo {}; my $x = foo //⏏ 'meow'»
This is not a bug -- Rakudo is parsing this correctly. A subroutine call in listop form always expects a term argument to follow, and // is a valid term (which evaluates to an invalid regex). See S02:4271, which also gives the example of
foo + 1 # foo(+1) -- term always expected after listop
The fact that foo is defined as a 0-parameter sub doesn't change the way it parses when used as a listop.
Thus one would either need to write "foo() + 1", or declare "foo" as a term.
02:43 <pmichaud> m: sub term:sym<foo> { }; my $x = foo // 'meow';
02:43 <camelia> rakudo-moar 29a110: ( no output )
Migrated from rt.perl.org#128572 (status was 'rejected')
Searchable as RT128572$
The text was updated successfully, but these errors were encountered: