On Tue, 30 Nov 2004 14:45:39 -0500, Dan Sugalski <[EMAIL PROTECTED]> wrote:
> At 11:20 AM -0800 11/30/04, Jeff Clites wrote:
> >% cat continuation6.ruby
> >def strange
> >     callcc {|continuation| $saved = continuation}
> >end
> >
> >def outer
> >     a = 0
> >     strange()
> >     a = a + 1
> >     print "a = ", a, "\n"
> >end
> 
> Through the joys of reference types, a will continue to increase
> forevermore, assuming the compiler hasn't incorrectly put a in an int
> register. (Which'd be wrong) 

I can see that there is true magic in the power of using references in
this way.  Nonetheless, how can the compiler figure out that it can't
use an integer here?  The compiler should use integers when it can,
but it sounds like you are saying that when a variable crosses a sub
call (which might invoke a continuation) it will then have to be a PMC
or String to do the right thing.

> Remember the PMC and string registers
> hold pointers to pmc/string structures, which is all we're preserving
> -- the *pointer* to the structure, not the contents of the structure.
> (Though that's an interesting thing to do for other reasons, like,
> say, transactions, we're not going to be doing that) The contents can
> change over and over without the register itself ever changing.
> 
> 
> 
> ># these two lines are "main"
> >outer()
> >$saved.call
> >

Bill

> >JEff
> 
> --
>                                 Dan

Reply via email to