Hi Ben, On Sat, Jan 24, 2015 at 7:57 AM, Ben Coman <btc@openinworld.com> wrote:
I've found a fix for something that has annoyed me for a long time - but I can't determine what it might break.
1. In Workspace I evaluate the following
Halt enableHaltOnce. a := 1. self halt. b := 2. self haltOnce. c := 3. Transcript show: a + b + c.
2. In the debugger after it stops at the #halt, it takes a SINGLE <Step Over> to move to d:=2 - no problem.
3. Now <Restart> and then <Step Over> down to c:=3 and observe: * the #halt now takes EIGHT (used to be SIXTEEN) steps to traverse (ouch!) * the #haltOnce takes THREE steps to traverse (good)
Tracing through for both #halt and #haltOnce it seems that the specific conditional reference to #halt in Halt>>signalerContext is the difference! Removing that condition results in the #halt behaving like #haltOnce, taking only THREE <Step Over>s to traverse a restarted #halt.
Halt>>signalerContext ^ signalContext findContextSuchThat: [ :context | (context receiver == self or: [ (context receiver == self class) or: [ context method selector = #halt ]]) not ]
What happens if instead you inline haltOnce to read haltOnce "Halt unless we have already done it once." (Smalltalk at: #HaltOnce ifAbsent: [false]) ifTrue: [Smalltalk at: #HaltOnce put: false. Halt signal] ? Now #haltOnce seems to have been operating without a problem for a long
timer, so presumably its okay to make #halt behave the same way. But this is deep stuff I don't fully understand. Anyone see a problem with removing that last condition?
cheers -ben
-- best, Eliot