Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TopLevelCallcc exception

8 views
Skip to first unread message

Yevgeniy Makarov

unread,
Apr 23, 2003, 4:09:39 PM4/23/03
to

What is TopLevelCallcc exception in SML/NJ? I get it when I try the
following code:

structure C = SMLofNJ.Cont;

val top_level = ref(C.isolate(fn (x:bottom) => ()));

let val x = C.callcc(fn k => (top_level := k; 0)) in x end;

fun abort(x:bottom) = C.throw (!top_level) x;

1+abort(3*2);

There is no problem with top level continuations in Scheme, for example.

Also, where can I get information about other SML/NJ features, such as the
function isolate from the signature COMPILE?

Thank you,
Yevgeniy Makarov

Matthias Blume

unread,
Apr 23, 2003, 5:45:25 PM4/23/03
to
Yevgeniy Makarov <emak...@cs.indiana.edu> writes:

> What is TopLevelCallcc exception in SML/NJ? I get it when I try the
> following code:
>
> structure C = SMLofNJ.Cont;
>
> val top_level = ref(C.isolate(fn (x:bottom) => ()));
>
> let val x = C.callcc(fn k => (top_level := k; 0)) in x end;
>
> fun abort(x:bottom) = C.throw (!top_level) x;
>
> 1+abort(3*2);
>
> There is no problem with top level continuations in Scheme, for example.

This is to avoid paradoxical situations related to the management of
the global symbol table (the environment that represents the bindings
that are known at toplevel). Basically, if you "jump back" to an
earlier point in the toplevel loop, you would have to roll back the
bindings that have been established in between. Doing so, however, is
rather tricky. Getting the toplevel environment right was difficult
enough, so the necessary implementation effort was probably seen as
outweighing the benefits of a feature of questionable (at best)
practical interest.

> Also, where can I get information about other SML/NJ features, such as the
> function isolate from the signature COMPILE?

I already posted a reply to your earlier question on this.

Matthias

0 new messages