[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Exceptions on JVM [was: Exceptions needs examples]

On 1/8/2014 3:03 PM, John Cowan wrote:
> Michael Montague scripsit:
>> For 'guard' to be really useful in real programs, it needs to be
>> cheap, particularly for the normal case (no exception raised). The
>> implementation in R7RS captures a continuation in the normal case
>> and in Foment, capturing continuations is expensive: it requires a
>> stack copy.
> The point is that on the JVM, stack copies are not possible, so only
> downward closures and upward continuations are supported.
I understand that. I am suggesting a way to implement the full semantics 
of 'guard' using only upward continuations.

I think this is the issue for Kawa: If all of the clause tests evaluate 
to false and the 'guard' has no 'else' clause, then 'raise-continuable' 
is invoked on the raised object within the dynamic environment of the 
original call to 'raise' or 'raise-continuable'. But the 'guard' clauses 
are evaluated with the dynamic environment of the 'guard'. If you use an 
upward continuation to get to the dynamic environment of the 'guard', 
then you can't get back to the continuation of 'raise' for the implicit 
'else' case.

Scheme-reports mailing list