[<<][packetforth][>>][..]
Sun Apr 2 09:12:51 CEST 2006

abort stack

Ran into a problem with the abort stack using coroutines. Apparently
this doesn't work:

load-coroutine  
generator x :: (1 2 3) { . yield } consume ; 
' x start x x x x x x .n

Because consume messes with the abort stack, which is also used to
perform file loading.. 

The core of the problem is the following: the abort stack is used to
isolate environments, i.e. when loading files, or executing code on
the console. In this setting, it is illegal for a subprogram to look
beyond its containing environment.

Abort stack = stack of environments + exit words = GLOBAL

The problem here is that the generator above uses consume to generate
a new environment with stuff on the abort stack: it uses a global
resource to perform a local state saving/restoring feature (consume).

This is OK, as long as the environments are CONTAINED. Making it a
generator violates that: control is returnned to caller with context
left on the abort stack.

How to solve this? The most straightforward way is to make map &
consume not use the abort stack, so they can be used in coroutines.




[Reply][About]
[<<][packetforth][>>][..]