Here is an input on the exception handling question:

  In (pseudo) C++, one can write
    try { ... }
    catch (A) { if (C) then handle_it else rethrow }
But in a functional language it would be more reasonable to write
    if (C) then catch(A) { handle_it }
or something like that, and let the compiler rewrite it to the C++
construction above (the latter which has the advantage that the handling
points are known in advance).

  Then this could be generalized: If f contains the handling of exceptions
E_1, ..., E_k, then f(x) rewrites to
    catch (E_1, ..., E_k) { f(x), rethrow if not caught }
Then f(x) is only computed if needed because it handles the exception, but
it also ensures that the exception is handled if f has the capacity to do
so.

  I am not sure how this idea would work out in a functional language, but
this would be a part of the analysis one would have to do when implementing
exceptions.

  Hans Aberg
                  * Email: Hans Aberg <mailto:[EMAIL PROTECTED]>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>



Reply via email to