I've got a program that involves passing data via custom messages with data (e.g. broadcast "mode1|param=something"). I use a "when I receive message" block to receive the message, parse it, and act accordingly.
In some cases, one message needs to take an action and then broadcast another message to take the next action.
The subsequent "broadcast" blocks don't seem to work when they're connected to the "when I receive any message" block. See this project as an example. When you hit the flag, the second broadcast is never received.
The old syntax (global message reporter instead of an upvar) seems to work as expected, for whatever reason. There's a script in the project you can swap in - both messages will display as expected.
to avoid reentrancy problems.
Can you say more about that? Sorry!
Not really ;(
Snap made an arbitrary decision on how to deal with script reentrance (mostly block).
You can "discover" details of this behavior by trial&error, source code analysis, or asking Jens or Brian.
No problem - thank you! Adding in the launch seems to fix it.
Thanks, @zakkolar for this report!
Yes, I did change the semantics of the "When I receive any message" hat block in v7.0.0 to make it "thread safe", i.e. to ensure that it runs to completion before it can be triggered again. As you've pointed out (and also @dardoro) that was probably a mistake, because it prevented tail-recursive broadcasts when using the "any message" option.
In the patch that I've just released (v7.0.3) I've reverted to the regular re-entrancy semantics. You may need to perform a "hard reload" (reload Snap! in the browser while keeping the shift key down) or to flush your browser cache in order for the changes to become active right away.