Here’s another idea. As usual, I offer it without regard for dev complexity or performance impacts because I don’t know. I could see where this would be high for both.
The idea would be to create a kind of flow control that doesn’t exist today - to execute a command when an expression evaluates to true. I think it would fit nicely as additional stack ops:
S.COND: [expr]
or
S.C: [expr]
So essentially it would set up a watch condition for the specified expression that is evaluated as often as possible without impacting performance. When the condition evaluates to true, it would execute the equivalent of S.POP.
There could also be flavors to pop the entire stack, or maybe even a set number of LIFO stack entries.
S.C.ALL: [expr]
S.C x: [expr]
where x is the number of stack entries to pop. Might also need:
S.C.CLR
to remove the watch condition.
I don’t use the stack all that much. For me, I think this would add a lot of use cases.