> i=0
> md = MyDesign.new
> 12.times do |i|
>   puts ">>>>>iteration: #{i}"
>   md.step 
> end

<snip>

> So it seems that the call to the continuation not only 
> continued execution at the statement after the wait, but it also restored 
> variables at the toplevel scope to their values at that time.

It won't restore variables to different values (that's a form of
continuation I use in Smalltalk, but not the way Ruby's works). 
However, it does restore the calling context, and since each iteration
through that loop is a new method call
(or new invocation of the block), you are sent back to the second
invocation instead of the eighth, and thus are seeing a different i
(well, actually, because you have an i=0 outside the loop, it's more
complicated than that... explanation at the bottom).  You shouldn't
see that effect for variables that are actually at the top level - for
example, try

j = 0
12.times do |i|
   j += 1
   puts ">>>>>iteration: #{i} (or is it #{j}?)"
   md.step
end

Anyway, the only real way to avoid this is to have your iteration be
in a separate thread from your callcc - is this feasible?  Once you
break it into threads like that, of course, you may find that callcc
is overkill and you can get the same effect with simple suspend/resume
semantics.

(As for what I think is actually going on with the value of i,
although i is indeed a top level variable, inside the call to times is
some equivalent variable which is indeed a block paramater, and thus
is recreated each time through the loop, and so you're sent back to a
different version of that variable, which is then assigned to i the
next time through... so it amounts to the same thing.)

Avi