develooper Front page | perl.perl5.porters | Postings from July 2013

Re: Try/Catch Exception Objects: Possible?

Thread Previous | Thread Next
David Golden
July 23, 2013 18:51
Re: Try/Catch Exception Objects: Possible?
Message ID:
On Tue, Jul 23, 2013 at 2:32 PM, David Golden <> wrote:
> On Mon, Jul 22, 2013 at 5:44 PM, David E. Wheeler <> wrote:
>> I would be interested in learning what thoughts others have had.
> The last time I thought this through in any detail, this is what I came up with.
> I got some helpful feedback, but never found the tuits and inspiration
> to attempt to do anything about it.  Maybe someone else will find it
> useful.

I should add that it would be really good to clarify what the expected
benefits of core exception objects would be and what the costs would
be, to be sure that those survive whatever implementation is developed
(if it happens).

For example:

Being able to detect specific types of error without parsing a string
reduces fragility (pro), but adds object creation overhead for every
error (con).

An implementation could consistently capture a stack trace when the
exception is thrown (pro), but generating a stack trace for every
exception could also be expensive for something only rarely needed

An implementation could define clearer semantics around a "rethrow"
(pro) -- is it a continuation as if unhandled or a new exception
originating at the point of rethrow -- but this adds extra complexity
that people have to learn and plan for in their code (con).


David Golden <>
Take back your inbox! →
Twitter/IRC: @xdg

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About