K Stol <[EMAIL PROTECTED]> wrote:

> From: "Leopold Toetsch" <[EMAIL PROTECTED]>

>> The C<exit> can happen deeply inside some called subs. The exception
>> can be caught e.g. in main, to do some cleanup before really shutting
>> down. Makes sense to me.

> You've got a point there. But it's a bit a matter of taste I think. I seems
> a bit odd to me that an exception is thrown while nothing unexpected is
> done. Cleaning up is ok, of course. But IMHO an exception is an error in the
> program after which the program can exit in a nice way (handle these
> exceptions nicely).

Pie-thon has more of that. Some iterators are throwing an StopIteration
exception when they are finished. It makes sense though. You can't
return a single retval that is the loop test variable too.

  while (item in next_item()) ...

doesn't work it a "false" item is a valid return value. An exception is
just an handy way for a non local (loop) exit or branch. Perl6 will have
"undef but true" for such cases.
An exception isn't an error.

> So, popping an integer from the stack into a N-register, for example is an
> exception (well, in that particular case it's a bug, probably), or when a
> stack underflow occurs. Those thinks sound like exceptions to me. But
> exiting the program is quite a normal thing.

We have many such C<internal_exception>s like above in code. Probably
only a few of these will become C<real_exception>.

> Oh well, it's not *that* important. :-)

Its important to sort out, what'll be a real exception though.

> Klaas-Jan

leo

Reply via email to