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

Re: Try/Catch Exception Objects: Possible?

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
July 23, 2013 21:11
Subject:
Re: Try/Catch Exception Objects: Possible?
Message ID:
CAMoYMM8z21+W3mkD15B7n7KWKBjhvx96DEqJkyFkGUDiJJQq0w@mail.gmail.com
On 23 July 2013 21:50, Paul LeoNerd <leonerd@leonerd.org.uk> wrote:
> On Tue, 23 Jul 2013 15:04:49 -0400
> David Golden <xdg@xdg.me> wrote:
>
>>     catch error::io, error::network {
>
> I'd be quite keen to avoid such things.
>
> Nowwhere else in Perl do we do this sort of handling of code dispatch
> based on argument types (except for normal dynamic virtual method
> dispatch).

And smartmatch, no ?

> One thing I've always liked about Try::Tiny et.al. is that
> they don't get involved in working out how 'catch' dispatch should work.

Having exceptions as objects can be very useful for testing where they
come from, or what type of error has occurred. If a new try/catch
syntax doesn't make this a bit easier than a bare ->isa or ->can call,
then what is it good for?

> We our core 'catch' to have to make such decisions, it suggests a
> slippery slope:
>
>  Do we start adding similar logic in other places? Multimethods?
>
>  Does it just use class names? Can we put custom logic in - where{} clauses?
>
> --
> Paul "LeoNerd" Evans
>
> leonerd@leonerd.org.uk
> ICQ# 4135350       |  Registered Linux# 179460
> http://www.leonerd.org.uk/

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