Michal Wallace writes:
> On Mon, 12 Jan 2004, Luke Palmer wrote:
>
> > Michal Wallace writes:
> > > On Mon, 12 Jan 2004, Luke Palmer wrote:
> > >
> > > > I have somewhat a predicament. I want to create a continuation, and
> > > > have that continuation stored in the register stack that it closes
> > > > over (this is how I'm implementing a loop with continuations).
> > >
> > > Hmm. That sounds like Coroutine.
> >
> > Uh, how so? Are we mixing up Continuation/Coroutine vocabulary again?
>
> :)
>
> Well... A Coroutine is a pausable, resumable continuation, right?
> Or basically a closure with a continuation inside it.
Both of those sentences seem wildly redundant to me. I think we might
be stuck on vocabulary. We're surely both understanding the same thing
in different ways.
A continuation is one snapshot -- it never changes, it never runs. To
invoke the continuation is to take you back to that snapshot and start
running from there. To invoke it a second time is exactly like invoking
it the first time.
A coroutine is like a variable that holds continuations, and updates
itself whenever it "yields". I guess that's the best way I can put it
with my affliction against coming up with good similes.
I think this is what you were saying... maybe.
But it's easy to implement a loop using a single continuation. Like
this:
newsub $P0, .Continuation, again
again:
# ... loop body
invoke $P0
That's not *exactly* what I was doing. All I was doing was
implementing a loop that called subs repeatedly with a "backtrack"
continuation, so they could jump out at any point in their execution.
It seemed odd that there was no way to keep the continuation I was
giving everyone around without using a lexical pad.
It's working now (there are some weird things going on though which I'm
trying to track down), and I don't really mind the lexical pad.
Luke
> I was just guessing how you might be implementing the loop. It sounds
> like a recursive tail call, but that struck me as a job for goto
> instead of a continuation. So I thought maybe you needed the
> continuation to save for later, and that made me think of a Coroutine.
>
> That's what was running through my head anyway. As for
> why I mentioned it based on all those assumptions... uhh,
> beats me. My real point was just the part about the
> calling conventions the thing you're calling in P0. :)
>
> Sincerely,
>
> Michal J Wallace
> Sabren Enterprises, Inc.
> -------------------------------------
> contact: [EMAIL PROTECTED]
> hosting: http://www.cornerhost.com/
> my site: http://www.withoutane.com/
> --------------------------------------
>