[squeak-dev] Abandoning in debugger and ensure: blocks
Christoph.Thiede at student.hpi.uni-potsdam.de
Tue Jun 21 09:32:57 UTC 2022
no, the semantics of Debugger's Abandon do not have changed: When you press Abandon, all ensure: contexts will be run that are not yet active.
[x := 1.
[x := 2].
If you abandon the debugger, x will be set to 2.
[x := 1.
[x := 2.
x := 3].
If you abandon the debugger, x will be set to 2 (but not to 3 - so the active ensure: context will *not* be continued).
The only thing that has changed is the semantics of Process >> #terminate:
[[x := 1.
[x := 2]] fork.
x will be set to 2.
[[:exit | [x := 1.
[x := 2.
x := 3]] valueWithExit] fork.
In Squeak 5.3 and earlier, x will be set to 2 only.
In Squeak 6.0 and newer, x will be set to 3, so the active ensure context will indeed be completed during termination.
To restore the old termination semantics in Squeak 6.0, you can send #terminateAggressively instead of #terminate. This is what Debugger's Abandon uses under the hood.
You can find more examples in DebuggerTests no. 19 - 24. For the termination semantics, see also the tests in the AbstractProcessTest hierarchy.
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Tony Garnock-Jones <tonyg at leastfixedpoint.com>
Gesendet: Dienstag, 21. Juni 2022 10:50 Uhr
An: The general-purpose Squeak developers list
Betreff: [squeak-dev] Abandoning in debugger and ensure: blocks
Is it true that with recent changes to termination, if I "Abandon" a
process in the debugger, that process's `ensure:` blocks will NOT run?
That's a change from before, right?
Or am I mistaken?
If that's genuinely the case, is there some mechanism I should be using
to `reallyEnsure:` that something happens as part of process termination?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev