That’s actually not quite right, Brian. Snap! has real macros with first-class environments, and - as @mark4sisb - correctly points out, you can use a ringified expression in the first slot of the blue OF-reporter to bind it to the environment (sprite, stage or procecure) in the second slot.
Hmm, your examples look to me like what I said, pulling one variable out of an environment. I dunno, maybe OF is doing what I wanted my λ block to do. But it does it weirdly; I mean, THIS SCRIPT is a script, not an environment. Maybe I’d be happier if you said
[text] OF (ENVIRONMENT OF (THIS SCRIPT))
so it’d be clearer just what you’re attaching to the text.
Actually, the “Script” is the full procedure, the ring, including its inputs, environment, caller, continuation etc. etc. Internally I’m calling this a “context” (but don’t expose this to the user). When you bind a procedure to another one using OF you give it full access to whatever the target ring has access to.
Yeah, that’s what I mean! I want field selectors, so to speak, to pull apart the pieces.
I’m not 100% sure I have a coherent story to tell here. I mean, Scheme doesn’t seem to need first class environments, although some implementations provide them as an extension to R∞RS. But your OF example is more or less (EVAL EXP ENV) which is at the core of every interpreter, except that the second input is something more complicated than an environment.
but … why? What would you do with it? If it isn’t currently running there’s nothing you can do with it, except stop or pause it, both of which you already can.
Pressing the spacebar should simply do nothing as each script pauses itself. However, both scripts identify the same process as “themself” and both try to pause it, resulting in one of the scripts not being paused and instead running the “move 10 steps” block.
I want the ability to just pause one script without wrapping it in anything special, that is to say I want to be able to create a “pause script” abstraction that doesn’t require wrapping the script in a custom c-shaped block that stores the process itself and passes it to the “pause script” block.
It requires a primitive, or at least some kind of an identity check (rather than just equals) (IS IDENTICAL TO won’t fix jens’ example with its current behaviour, I checked).
I’m pretty sure you can still do this with plain continuations. I’ll make a proof-of-concept if I have time.
Hi. I’m testing out the of process block, and I am confused by what block does. It seems like it’s the same as script except if you use wait in the body of the process, and then it gets kind of weird. I expected it would return the block currently being run.
Additionally, what is step process used for? I assumed that it would skip to the next block in the process when paused, but it doesn’t do that. Or maybe it does, and I’m misinterpreting the output?
So they’re supposed to do exactly what I thought they’d do, but for some reason it seemed like they weren’t working? block often returns the whole script. I’ll retry step, though. I did have it paused the last time. Perhaps it’s because I was using a script variable to store the process.
The thing with “block” is that, for your main script to be running and getting the “block”, the process you’re asking must’ve yielded. Yields only happen at waits and the end of loops, or if a script takes too long. So you’ll only get information at certain times.
The input names to the ring indicate the inputs the current block is recieving. It is much clearer if you split by blocks and do a little magic. Try running this script:
Yields only happen at waits and the end of loops, or if a script takes too long.
On my list of wanted features is “pause on error,” so that when a script gets an error message, instead of stopping it just pauses, and then you could use THIS BLOCK to help debug it.
Why is this the case? Is this a technical limitation/consequence, or does it have any practical value?
Why are the inputs displayed as input names, especially if the input variables are not used in the script body? And in the example, what input does that number represent, and why does it count down?
Sorry for all the questions. I’m just a tad confused.