develooper Front page | perl.perl6.language | Postings from October 2005

Re: Exceptuations

Thread Previous | Thread Next
From:
Yuval Kogman
Date:
October 5, 2005 10:25
Subject:
Re: Exceptuations
Message ID:
20051005172447.GG23889@woobling.org
On Wed, Oct 05, 2005 at 16:57:51 +0100, Peter Haworth wrote:
> On Mon, 26 Sep 2005 20:17:05 +0200, TSa wrote:
> > Piers Cawley wrote:
> > >>Exactly which exception is continued?
> > > The bottommost one. If you want to return to somewhere up its call
> > > chain, do:
> > >
> > >   $!.caller(n).continue(42)
> >
> > Whow, how does a higher level exception catcher *in general* know
> > what type it should return and how to construct it? The innocent
> > foo() caller shouldn't bother about a quux() somewhere down the line
> > of command. Much less of its innards.
> 
> Well said.


No! Not well said at all!

The exception handler knows *EVERYTHING* because it knows what
exception it caught:

	CATCH {
		when some_kind_of_error {
			$!.continue($appropriate_value_for_some_kind_of_error)
		}
	}

-- 
 ()  Yuval Kogman <nothingmuch@woobling.org> 0xEBD27418  perl hacker &
 /\  kung foo master: /me climbs a brick wall with his fingers: neeyah!



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