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

Re: exception systems

> > |   This is a myth.  SML/NJ's implementation strategy happens to allow a
> > |   very cheap implementation of call/cc.  It was, however, not chosen
> > |   just because of that.  Also, I don't know what you mean by `making
> > |   everything else somewhat more expensive'.  Admittedly, it is a
> > |   controversial topic, but if you look at Appel and Shao's papers on
> > |   this issue then you will see that the jury is still out.
> > 
> > We can discuss this ad infinitum, but it is not a myth.
> Then, please, be specific.  What is slowed down by SML/NJ's call/cc
> mechanism?

Three things (at least):

1) Non-tail function calls, because you need to initialize a dynamic
link in the frames that you create.

2) Function return, because you need to follow the dynamic link to
reset the caller's frame.

3) References to parameters when the reference follows a non-tail call
(because frames can't be extended in place, you actually have to chain
the various parts of a function's frame, each part corresponding
to a non-tail call in the function's body).