May 7, 2012

Perl Core Syntax Wishlist: an Exception Stack

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, 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: 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.


  1. It's nearly the same what my company needs ;) And i wrote something what allow to work in this way.

    You just need few classes of exceptions:

    and so on.

    Next, alias for die/croak (*throw = \&croak - this is our way).

    And next, I made a package (based on Try::Tiny): Try::Tiny::SmartCatch.
    It has a little strange syntax, but its power forgive this (i think ;) ).

  2. we should not, stop adding syntax to Perl because cpan modules are able to do it.


No trolling, profanity, or flame wars :: My Blog, my rules! No crying or arguing about them.