Skip Menu |
Report information
Id: 122286
Status: resolved
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: coke <will [at]>
stifynsemons <stifynsemons [at]>

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)

To: rakudobug [...]
Subject: recursive data structures hang when .perl'd
Date: Sun, 13 Jul 2014 20:47:34 -0400
From: Will Coleda <will [...]>
Download (untitled) / with headers
text/plain 351b
S02-names-vars/perl.t has several examples of recursive data structures that must be skipped because calling .perl on them hangs. e.g.: my $foo = { a => 42 }; $foo<b> = $foo; is $foo<b><b><b><a>, 42, "basic recursive hashref"; is ~$foo.perl.EVAL, ~$foo, ".perl worked correctly on a recursive hashref"; -- Will "Coke" Coleda
To: rakudobug [...]
Subject: using say (gist) on an object that contains a circular reference hangs/leaks
From: Stephen Simmons <stifynsemons [...]>
Date: Sat, 27 Jun 2015 22:31:38 -0400
Download (untitled) / with headers
text/plain 1.3k
It appears that using say on object1 which contains object2, which contains object1, causes Perl 6 to hang in an infinite loop, leaking memory (presumably gist is building an infinite string). I'm not sure this is really a Perl 6 bug so much as a novice user experience issue. What I expected to happen was for the code to output a stringified version of the object, just an object name really. In studying gist in S02, it appears it is trying to create a string that represents the contents, and while long lists are truncated, circular loops are not handled. As I am not explicitly creating an infinite structure I did not expect Perl to when it evaluated the data. This is an early experiment (for me) with Perl 6 classes, so any suggestions / corrections are of course welcome. Versions: This is perl6 version 2015.06-86-gacaeb17 built on MoarVM version 2015.06-44-g2c96984 Linux bela 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Sample code: class Location {...} class Item { has Location $.loc is rw; method locate (Location $l) { self.loc=$l; } method whereis () { return self.loc; } } class Location { has Item @.items; method put (Item $item) { push(@.items, $item); } } my $; my $; $l1.put($i1); $i1.locate($l1); say $i1.whereis;
Download (untitled) / with headers
text/plain 118b
Fixed in rakudo commit 397e221b4e205d0257ba2284f3792f07735c9c6d, roast commit a9f090cc42ce3425f770975918d6a53a08700fed

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at