Open p5pRT opened 7 years ago
This code hangs forever:
$ perl -MO=Deparse -e 'use constant FOO => do { my @x; $x[0] = \@x }; $_ = FOO' ^C
Workaround:
$ perl -MO=Deparse\,-d -e 'use constant FOO => do { my @x; $x[0] = \@x }; $_ = FOO' use constant ("FOO"\, do { my @x; $x[0] = \@x }); $_ = ${my $v = [[]];$v->[0] = $v; \$v}; -e syntax OK
B::Deparse dumps constants using its own function\, which doesn't handle self-referential structures\, so it loops forever. The -d switch tells it to use Data::Dumper instead\, which is fine with cycles.
Either B::Deparse needs to become smarter about cycles or -d should be on by default. 'perl -MO=Deparse' shouldn't just hang.
(This issue also affects Type::Tiny (which creates self-referential objects) in combination with 'use constant' or Function::Parameters (which inlines type constraints on parameters).)
Migrated from rt.perl.org#131148 (status was 'new')
Searchable as RT131148$