Leo~

On Wed, 8 Dec 2004 20:29:00 +0100, Leopold Toetsch <[EMAIL PROTECTED]> wrote:
> So my conclusion that (in combination with restoring registers to the
> values of continuation creation) I,S,N registers are almost unusable is
> correct?

I would disagree.  Let me take the above example and work with it a little:

  $I0 = 10
loop:
  $P0 = shift array
  dec $I0
  if $I0 goto loop

We are (for the moment) assuming that "shift array" somehow causes a
full continuations to be taken and then invoked it in a subsequent
call.  Then this code would infinite loop; however, so would this code
as the second call is returning through the first calls continuation.

  $P0 = shift array
  $P1 = shift array

On the other hand, if every call to "shift array" took a full
continuation, did some stuff, and eventually returned through its
return continuation.  Then neither would infinite loop, as every call
to "shift array" would have its own return continuation.

What this means is that care must be taken when you are writing code
that you expects to be invoked multiple times.  However, if you are a
function that on your second invocation returns via the continuation
from you first invocation, you should probably expect to be called
again because it happened the first time!  If you are expecting other
behavior, it is probably because one person wrote the whole chain of
calls and had some extra knowledge about the caller.  This author may
have to be a little wary about value vs reference semantics, but
programmers are fairly used to that pitfall by now.

Matt
-- 
"Computer Science is merely the post-Turing Decline of Formal Systems Theory."
-???

Reply via email to