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

Re: Try/Catch Exception Objects: Possible?

Thread Previous | Thread Next
From:
David E. Wheeler
Date:
July 25, 2013 10:26
Subject:
Re: Try/Catch Exception Objects: Possible?
Message ID:
E3C92B72-F457-44F9-B3A3-A272A5AA73F0@justatheory.com
On Jul 23, 2013, at 12:07 AM, David Nicol <davidnicol@gmail.com> wrote:

> Have you looked at the way Golang does exceptions? Their documentation discourages
> exception-driven control flow -- everything returns lists, and the convention is to make the second element the completion status, to avoid the out-of-band problem of returning special failure values -- but one could do it with their available tools.

No, but I have used Objective-C quite a bit, and it, too, discourages exception-driven control flow. Still, it has @try/@catch for those situations where it's unavoidable.

> Maybe golang-style panics would be best given their own parallel system, rather than touching the semantics of $@, no matter how slightly.
> 

> In short, I'm opposed to try/catch, as I think it's a tired idiom with superior alternatives, including what Perl's already got.

I think it's fine to have a parallel system, but Perl *already* has exception-driven control flow, and whether or not you or brian d foy prefers a different approach, I think the existing system should be improved.

Best,

David
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