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

variable self reference in regexp my $x = / $x / causes maximum recursion depth exceeded #2428

Closed
p6rt opened this issue May 12, 2011 · 4 comments

Comments

@p6rt
Copy link

p6rt commented May 12, 2011

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

Searchable as RT90456$

@p6rt
Copy link
Author

p6rt commented May 12, 2011

From @bbkr

[17​:30] <bbkr_> std​: my $x = / $x /; # hmm
[17​:30] <p6eval> std 01c24ce​: OUTPUT«ok 00​:01 117mâ�¤Â»
[17​:31] <bbkr_> rakudo​: my $x = / $x /; "" ~~ $x; # kabooom?
[17​:31] <p6eval> rakudo 678ad3​: OUTPUT«maximum recursion depth exceededâ�¤ in
<anon> at line 22​:/tmp/JEnOOsfLdhâ�¤ in <anon> at line 22​:/tmp/JEnOOsfLdhâ�¤ in
<anon> at line 22​:/tmp/JEnOOsfLdhâ�¤ in <anon> at line 22​:/tmp/JEnOOsfLdhâ�¤ in
<anon> at line 22​:/tmp/JEnOOsfLdhâ�¤ in <anon> at line 22​:/tmp/JEnOOsfLdhâ�¤ in
[17​:31] <p6eval> ..<anon> at â�¦

[17​:31] <TimToady> niecza​: my $x = / $x /; "" ~~ $x; # kabooom?
[17​:31] <p6eval> niecza v5-4-g2703ab0​: ( no output )
[17​:31] <moritz> I guess it should just evaluate $x to Any at
(non)-interpolation time
[17​:32] <TimToady> pugs​: my $x = / $x /; "" ~~ $x; # kabooom?
[17​:32] <p6eval> pugs​: OUTPUT«Error eval perl5​: "if (!
$INC{'Pugs/Runtime/Match/HsBridge.pm'}) {� unshift
@​INC, '/home/p6eval/.cabal/share/Pugs-6.2.13.16/blib6/pugs/perl5/lib';â�¤
eval q[require 'Pugs/Runtime/Match/HsBridge.pm'] or die
$@​;â�¤}â�¤'Pugs​::Runtime​::Match​::HsBridge'â�¤"â�¤*** '<HANDLE>' trapped by operatâ�¦
[17​:32] <moritz> perl6​: my $x; my $re = rx/ $x /; $x = 'a'; say 'abc' ~~ $re
[17​:32] <bbkr_> everything looks more atractive when there is explosion in
background :)
[17​:32] <p6eval> rakudo 678ad3, niecza v5-4-g2703ab0​: OUTPUT«aâ�¤Â»
[17​:32] <p6eval> ..pugs​: OUTPUT«Error eval perl5​: "if (!
$INC{'Pugs/Runtime/Match/HsBridge.pm'}) {� unshift
@​INC, '/home/p6eval/.cabal/share/Pugs-6.2.13.16/blib6/pugs/perl5/lib';â�¤
eval q[require 'Pugs/Runtime/Match/HsBridge.pm'] or die
$@​;â�¤}â�¤'Pugs​::Runtime​::Match​::HsBridge'â�¤"â�¤*** '<HANDLE>' trapped by operatâ�¦
[17​:33] <-- nymacro has left this server.
[17​:33] <TimToady> perl6​: my $x = rx/ $x /; $x = 'a'; say 'abc' ~~ $x
[17​:34] <p6eval> rakudo 678ad3, niecza v5-4-g2703ab0​: OUTPUT«Bool​::Falseâ�¤Â»
[17​:34] <p6eval> ..pugs​: OUTPUT«â�¤Â»
[17​:34] <masak> bbkr_​: feel free to report that one.

@p6rt
Copy link
Author

p6rt commented May 12, 2011

From @pmichaud

Not a bug.

Writing my $x = / $x / is roughly equivalent to writing something like

  my $y = -> { $y() }

and then executing $y(). You're pretty much guaranteed to get an
infinite recursion.

Pm

1 similar comment
@p6rt
Copy link
Author

p6rt commented May 12, 2011

From @pmichaud

Not a bug.

Writing my $x = / $x / is roughly equivalent to writing something like

  my $y = -> { $y() }

and then executing $y(). You're pretty much guaranteed to get an
infinite recursion.

Pm

@p6rt
Copy link
Author

p6rt commented May 12, 2011

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

@p6rt p6rt closed this as completed May 12, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant