At 8:46 AM +0100 3/23/04, Leopold Toetsch wrote:
Piers Cawley <[EMAIL PROTECTED]> wrote:
Dan Sugalski <[EMAIL PROTECTED]> writes:

And what control stack? The continuation chain is the control stack, surely?

Nope. There's the exception handlers, at the very least.

 Just add a field to the continuation structure "NextExceptionHandler"
 which points to the continuation of the next exception handler in the
 chain.

What about C code that either installs exception handlers or throws exceptions?

Or multiple nested exception handlers, or serial exception handlers in a block... And then there's the fun with exception handlers and coroutines.


It's a stack, like it or not.

>> Possibly some lexical pad stuff. (Though of that I'm less sure)

 I've always wondered why lexical pads have their own stack. I'd hang it
 off the Sub object and, when the sub's invoked, shove the current pad
 into a control register, which then gets closed over by any
 continuations that get made. Invoking a continuation restores the pad
 register and away you go.

Interesting idea. Well, the control register is a pointer in the context structure. We should be careful not to use up too many PMC registers.

But the current lexical pad structures are suboptimal (searching is
O(n)). OTOH we need some kind of linked lists of pads, which matches the
single item stacks approach.

Just because the current version's implementation is broken doesn't make the concept wrong. :)
--
Dan


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to