Front page | perl.perl6.language |
Postings from September 2005
From: Yuval Kogman
September 29, 2005 02:25
Message ID: 20050929092501.GD29485@woobling.org
On Thu, Sep 29, 2005 at 10:49:40 +0200, TSa wrote:
> BTW, I would call *intentional* exceptions terrorism.
Then I would call terrorism non linear control flow ;-)
In that case Afghanistan might be harboring computer scientists that
really like CPS, and bush is Java ;-)
> In lack of a better word I use Event and we get
> Event::Exception, Event::Control, Event::Warn and
> possibly Event::Hint, Event::Log and Event::Fun :)
An event is something external that happens... It does not affect
the control flow of an application.
Exceptions work well to describe this:
The normal flow is up and down the call graph, laying bread crumbs
in the form of a stack, and going back from where you came.
Exceptions let you jump instantly to another place in the call
graph. All I'm saying is that to complement the normal "exceptions
jump back out", you can jump out, and jump back in.
An event is a general thing that can be implemented with exception
like semantics, but implies nothing on the control flow of the
An error is an exception that happenned because something went badly
Now it's my turn at illustrative metaphors ;-)
The call graph is a big maze you go through.
When you find an *error*, in the form of a minotaur, you use the
exception handling mechanism to run away.
You jump instantly to a safe place in the labyrinth.
Although this is not consistent with the mythology, presume that the
reason you entered the maze was that you were trying to get results.
Most exception handlers are safe places when you can gather your
self, realize that 'oh crap, i just met a minotaur', and tell
whoever you sent you in there that there's no way you're going back
All I'm trying to say is that when there is an exception - a leap
out from a dangerous place to a safe one, due to an error, the code
may choose to deal with the error by giving you a big stick. Then
you can go back and beat the minotaur into submission, and resume
with trying to get results.
() Yuval Kogman <email@example.com> 0xEBD27418 perl hacker &
/\ kung foo master: /me whallops greyface with a fnord: neeyah!!!!!!!