I came up with this idea to be able to get the values of all the variables in the project by grabbing them from the (my [blocks]) list, and that worked.
blocks (procedures) need to be bound to an environment, otherwise they cannot access things like environment variables. Use the OF or ASK block to place them into a context.
Huh, that works, but if I'm able to call a variable directly, I'd expect to be able to call the same variable from the my blocks list, especially a global variable.
Also, if you're not going to fix it, at least add an error message.
It's the same thing, yet it sill gives an error, and the bigger problem is, the error doesn't even say anything.
Isn't the environment, the sprite that is running the call block?
I can understand why a local variable needs to be called from the sprite it's in, but I can't understand why a global variable needs to be called from a sprite.
It wasn't a workaround for what I originally wanted to do. I wanted to be able to grab all the variables in any project, then be able to record them, to play them back later. Like the project recorders some users have made.
a symbol needs to be put into a context to be be associated with a meaning. At the syntax-analysis level blocks are just that - symbols. You can take them apart and reassemble them. Then you put them into a context. Some blocks don't require an explicit context, e.g. the math operators, because they don't have side effects. Variables require an environment. There is no such thing as a "global" or "local" variable symbol, because variables are dynamically resolved at runtime. You don't want to assume the caller's environment because then you wouldn't need to use syntax-analysis/genesis at all, instead you can just use the blocks from the palette. Your tautological infatuation with meta-programming is getting on my nerves, because I keep having to point out that it doesn't lead to anything, it's all circular logic.
I found this bug too a while back in a BASIC to Snap! compiler I was writing. I solved it by compiling variable gets to the get variable block from the Create Variables library. But I didn’t think of using the ASK or OF block. That seems to be a better solution.