I have come to wish many things were part of Perl syntax that are not, and no using external modules is not enough for me. I think it’s time Perl got the features as part of the language itself (and yes I suppose I could settle for feature.pm, and no I’m probably not going to write them myself, I’m not smart enough yet). The first of these is a proper exception stack. I want to be able to write:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
use 5.018;
use warnings;

sub foo {
    throw Exception->new( 'message' );
}

try {
    foo();
}
catch ( 'Exception' ) {
     say "$_"; # object stringifies
}
catch ( 'Exception::Other' ) {
     say $_->message #also has an accessor
}
finally {
     ...
}

I think we need throw, try, catch, and finally keywords. And no I don’t think it makes sense to have Object->throw. In fact I think this Original Perl 6 Syntax Proposal reads like just what we need in Perl 5. Unfortunately I think this is what we are getting in Perl 6, which IMO is not as nice.