G'day holli,
This interested me because it seemed to be (sort of) the opposite of what a newline does with Perl5's die. Adding a newline to the message stops additional information such as line number and code source (not actually a stack trace):
$ perl -e 'die "with info"' with info at -e line 1. $ perl -e 'die "without info\n"' without info $
However, when I tried that with Perl6, it printed the message (with a newline where added) and the same information regardless of whether a newline had been used:
$ perl6 -e 'die "with info"' with info in block <unit> at -e line 1 $ perl6 -e 'die "without info\n"' without info in block <unit> at -e line 1 $
Putting the die in a sub, didn't change the Perl5 output:
$ perl -e 'sub dead { die "with info" } dead()' with info at -e line 1. $ perl -e 'sub dead { die "without info\n" } dead()' without info $
But, with Perl6, it gave the same information as before, plus info on the sub calling the die, with and without a newline:
$ perl6 -e 'sub dead { die "with info" }; dead()' with info in sub dead at -e line 1 in block <unit> at -e line 1 $ perl6 -e 'sub dead { die "without info\n" }; dead()' without info in sub dead at -e line 1 in block <unit> at -e line 1 $
I tried a further level of calling. The Perl5 output was unchanged. The Perl6 output added the extra level to the stack trace but was otherwise unchanged.
$ perl -e 'sub drop { dead() } sub dead { die "with info" } drop()' with info at -e line 1. $ perl -e 'sub drop { dead() } sub dead { die "without info\n" } drop( +)' without info $ perl6 -e 'sub drop { dead() }; sub dead { die "with info" }; drop()' with info in sub dead at -e line 1 in sub drop at -e line 1 in block <unit> at -e line 1 $ perl6 -e 'sub drop { dead() }; sub dead { die "without info\n" }; dr +op()' without info in sub dead at -e line 1 in sub drop at -e line 1 in block <unit> at -e line 1 $
I've tinkered with Perl6 every few years or so, just to see progress, but I'm very much a novice. Please provide some example code and output demonstrating what you're describing; it's entirely possible I've missed the point.
Assuming the version number refers to a date (YYYY.MM), it looks like my copy of Perl6 is about 18 months old: perhaps the behaviour you describe is new.
$ perl6 -v This is Rakudo version 2016.04 built on MoarVM version 2016.04 implementing Perl 6.c.
I'm pretty sure the Perl5 behaviour has always been the same (such as I've shown); I certainly recall using it in v5.6. Just for completeness, my current version:
$ perl -v | head -2 | tail -1 This is perl 5, version 26, subversion 0 (v5.26.0) built for darwin-th +read-multi-2level
Update (cosmetic): I removed instances of "ken@ganymede: ~/tmp", which are part of my complete prompt, unrelated to anything I posted, and really just noise. I normally take these out before posting; a few had slipped through this time.
— Ken
In reply to Re: [Perl 6]: Small discoveries VI, die
by kcott
in thread [Perl 6]: Small discoveries VI, die
by holli
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |