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 25, 2013 13:50
Subject:
Re: Try/Catch Exception Objects: Possible?
Message ID:
CAOeq1c_otg=kY=ovvSdqPHoYnzN+JTaZ+Arq4rimpkWikTBT-A@mail.gmail.com
On Thu, Jul 25, 2013 at 7:54 AM, Kent Fredric <kentfredric@gmail.com> wrote:
> Of course, "dead simple" and "dead simple and also useful" may be 2
> different things.

I think what David is getting at is that we don't have to solve
everything at once.

I'll paste what I said earlier:

It might make sense to split this up into relatively orthogonal chunks:

(1) can we change from core throwing string exceptions to throwing
objects?  (if so, should it be flat or hierarchical)

(2) can we change die to munge strings/references/objects into a
consistent framework?

(3) can we define semantics for a core try/catch/finally/etc construct

> Take this code, which *seems* simple enough that it might work:

That's almost intentionally pathological, though.  And the failure of
existing stacktrace tools on exception objects is an existing problem
in those modules irrespective of a change in core.

> You have to start doing crazy (and expensive in pureperl) things just
> to have a useable exception class if you try using objects.

Like what?  caller() and constructing a proper message that matches the form?

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