In procedure YIELD, you refer to a variable COROUTINE that doesn’t exist in this scope.
offtopic, for @jens
See, this is why Logo uses dynamic scope. If Snap! were dynamically scoped, it would’ve done what they mean. :~)
Offtopic
Quick&dirty dynamic scope variable getter
Used to obtain variables traversing the call stack
But, I’m not sure if it’s a way to go…
The OP already scan a call stack to get parent with ...
It’s a problem with the general concept. The “yield” should be a method of a given coroutine and be bound to that object.
Or be called with live coroutine as a parameter
Or something like this to refer to enclosing lexical scope should be invented.
There is
from the Metaprogramming library
BTW: () of () may have predefined selectors for common this caller, script
might i ask, what is this project for? i see a “lua corutine from ring” block, but i want to know what exactly you’re making
I just felt like making a script that can pause itself using continuations
so, like, you call the coroutine and then you can pause it if you need to, midway?
i actually have some experience in lua, but i havent tried coroutines as of yet, i havent had a real need for them in any of my projects.
yes, the coroutine can pause.
btw, by interruptible I meant can pause
Quick&dirty dynamic scope variable getter
My point wasn’t to suggest that the OP invent dynamic scope. I was trying to convince Jens (really just for him!) why it was a good idea for Logo to use dynamic scope even though lexical scope is the official right thing; kids’ expectations generally are that if a variable exists, it’s in scope. That’s why the OP didn’t understand the error message; “if a variable exists, it’s in scope” really is much more natural than the other way.
scope is hard, not just for beginners. Which is - I guess - one of the raisons d`être for OOP. Come to think of it, OOP sorta does offer a wacky form of dynamic scope…
Come to think of it, OOP sorta does offer a wacky form of dynamic scope…
Could you expand on this? I don’t know what you mean. Tnx.




