What c.l.py's opinions about Soft Exception?

Lie Lie.1296 at gmail.com
Sun Mar 9 13:45:43 EDT 2008


On Mar 9, 9:29 pm, Kay Schluehr <kay.schlu... at gmx.net> wrote:
(snip)
> You are an appropriate person to consider the workflow in a dynamic
> language, no matter how the language is implemented internally.

I agree, but the only thing I'm not confident to talk about is how
it'll be implemented, since I think an idea should suggest how it can
be implemented in practice to show that it's not just a nonsense paper
idea that's not possible in reality.

> Just start with function calls
>
>    maybe_raise(ZeroDivisionError)
>
> The only requirement is that maybe_raise has to know when it shall
> raise ZeroDivisionError. This depends on whether the exception is
> caught. How do the program knows this in advance? There are no static
> analysis techniques available.

Perhaps similar technique the compiler uses to determine whether a
function is a normal function or a generator function? Positive
forward lookup for any soft exceptions, which would then activate
matching soft exceptions inside the code?

> When maybe_raise is entered the system must know that the exception is
> handled in the future. You can't inspect the call stack for this
> purpose because the call stack represents past events and
> continuations ( and you can't rely on names ).
>
> So you need something like this
>
>    do_softexception(ZeroDivisionError)
>    try:
>       TRY_BLOCK
>    except ZeroDivisionError:
>       EXCEPT_BLOCK
>
> But this looks odd and the solution isn't DRY. So better one macro-
> transforms a new statement into this form.




More information about the Python-list mailing list