Description
Expected Behavior
Calling util.yield
should indicate to the VM and Runtime that the current block is not yet done and needs to be called again during the next time step. This behavior should be consistent regardless of the block type. Returning a Promise from the reporter can work around the issue, if that's compatible with the implementation.
Actual Behavior
From @stefania11 / @eesh / @tqiu8:
The block works as intended as a “command” block. That is, it waits until it has received a response from classification server and sets the state to FINISHED to stop yielding.
It seems to “wait” when used as a reporter block as long as it is just “clicked” on to make it run.
Have tested this by printing the state changes, and First and Second statements on L158 and L170 to console.But when used as a reporter with another block like the = operator, yield() doesn’t seem to reevaluate the function anymore. I’ve come to this conclusion based on the printed state changes. The state changes to PENDING (after which it yields for the first time) and then there is no more output. Running it once again changes its state to FINISHED and it returns the value. Meaning the state wasn’t reset to IDLE which can only happen when the function wasn’t reevaluated.
Sorry for the big wall of text. Please let me know if my understanding of yield is wrong.In short: I believe yield() doesn’t reevaluate the block when used as a reported in conjunction with operators or other blocks that take reporter as input.
Steps to Reproduce
- Create an extension with a reporter which always yields
- Insert the yielding reporter into another block, such as
say
or an operator - Run the block stack
- Note that the reporter does not yield appropriately