Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

// (definedness) operator confused for null regex #5434

Closed
p6rt opened this issue Jul 8, 2016 · 4 comments
Closed

// (definedness) operator confused for null regex #5434

p6rt opened this issue Jul 8, 2016 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 8, 2016

Migrated from rt.perl.org#128572 (status was 'rejected')

Searchable as RT128572$

@p6rt
Copy link
Author

p6rt commented Jul 8, 2016

From @zoffixznet

<Zoffix> m​: sub foo {}; my $x = foo // 'meow'
<camelia> rakudo-moar 29a110​: OUTPUT«===SORRY!=== Error while compiling <tmp>␤Null regex not allowed␤at <tmp>​:1␤------> sub foo {}; my $x = foo //⏏ 'meow'␤»

@p6rt
Copy link
Author

p6rt commented Jul 8, 2016

From @pmichaud

<Zoffix> m​: sub foo {}; my $x = foo // 'meow'
<camelia> rakudo-moar 29a110​: OUTPUT«===SORRY!=== Error while compiling
<tmp>␤Null regex not allowed␤at <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 )

Rejecting ticket.

Pm

@p6rt
Copy link
Author

p6rt commented Jul 8, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jul 8, 2016

@pmichaud - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Jul 8, 2016
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant