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

Re: exception systems



|   Dynamic-wind might have its place, but not with call/cc.  I see
|   call/cc as a low-level mechanism, and we all know how you get a
|   call-with-context that does take care of dynamic-wind from a low-level
|   call/cc.

I'm confused about what you are saying.

If the user is using something like dynamic-wind, then to a first
approximation all uses of cwcc must be replaced by those of the
version that understands the context.  Otherwise the program will not
work.

I don't care what you call the different versions.

|
|   So, yes -- call/cc in SML/NJ must take exception handling into account
|   -- but it is just one extra register to save.

In many implementations of dynamic-wind, it is exactly one word as
well, but it is there.

Whether it is mapped into a register or in memory is not that
interesting.

Whether it is already consed up or smeared out into several words that
must then be copied is an issue of whether you are consing it eagerly
or lazily.

By saying that it is only one word, you are saying that SML paid the
cost of consing it into a single word early, rather than lazily on
demand.

Either way, cwcc has overhead on top of the control-structure
collection.  Implementations trade off on this overhead in the same
way that they trade off on the overhead of the control-structure
collection.

SML has decided to make cwcc very cheap by making everything else
somewhat more expensive.  Other implementations have different goals.

Given that the single procedure call solution does not preclude the
reification of the continuation, but is often of lower cost (and I
would claim is of lower cost even in SML), I see no reason to pay any
more.