From: Jim Weirich Date: 2006-05-24T01:42:05+09:00 Subject: Re: How to "go to" in a RUBY script . . . Leslie Viljoen wrote: > As I understand it, continuations seem like blocks where all the local > (instance) variables are automatically "static" (to use C's word). So > you can go back to execute that block again at any time from anywhere > and it's previous state is intact. Is that right? Almost. Neither the values of global variables nor local variables in Ruby code are preserved. However, the values of local variable in any C-implemented methods /are/ preserved (and I suspect this is an artifact of implementation rather than a conscience design choice). What a continuation actually preserves is the state of the "call stack". In other words, you can have A call B and create a continuation inside of B. You can then return from B and from A, and then call the continuation and you are back inside of B (as called from A) as if you had never left. The state of the local variables are whatever they were when you left them (i.e. they are not restored to the values they had when the continuation was created). Does that help? -- Jim Weirich -- Posted via http://www.ruby-forum.com/.