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

Re: Try/Catch Exception Objects: Possible?

Thread Previous | Thread Next
From:
David Golden
Date:
July 23, 2013 18:51
Subject:
Re: Try/Catch Exception Objects: Possible?
Message ID:
CAOeq1c8_M0gKRBDPARu7ucRxRAjkH2euTKVae7o2MqY+7KuJLg@mail.gmail.com
On Tue, Jul 23, 2013 at 2:32 PM, David Golden <xdg@xdg.me> wrote:
> On Mon, Jul 22, 2013 at 5:44 PM, David E. Wheeler <david@justatheory.com> 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.
>
> https://gist.github.com/dagolden/6064767
>
> 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
(con).

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

-- 
David Golden <xdg@xdg.me>
Take back your inbox! → http://www.bunchmail.com/
Twitter/IRC: @xdg

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About