[squeak-dev] `ensure:` ... doesn't (in some circumstances involving nesting `ensure:` blocks in `ensure:` handlers).

Jaromir Matas mail at jaromir.net
Thu Jul 7 16:37:46 UTC 2022


Hi,

That example nicely demonstrates the semantics difference between Abandon and Terminate in Debugger :)

Expected output:

    outer1
    (debugger appears; click 'abandon')
    inner

or:

    outer1
    (debugger appears; click 'terminate')
    inner
    outer2

best,
Jaromir

From: Marcel Taeumel<mailto:marcel.taeumel at hpi.de>
Sent: Thursday, July 7, 2022 18:09
To: squeak-dev<mailto:squeak-dev at lists.squeakfoundation.org>
Subject: Re: [squeak-dev] `ensure:` ... doesn't (in some circumstances involving nesting `ensure:` blocks in `ensure:` handlers).

Hi Tony --

Seems to work now. Except that you will also get MNU #stepToCallee after abandon.

Best,
Marcel

Am 04.11.2021 10:56:48 schrieb Tony Garnock-Jones <tonyg at leastfixedpoint.com>:
Also of note: using `self halt` to debug `ensure:` blocks is made
difficult by this! (Because the process just... disappears!)

On 11/4/21 09:59, Tony Garnock-Jones wrote:
> Here's an example of where `ensure:` doesn't quite do what it says on
> the tin:
>
>     [
>       [Processor activeProcess terminate] ensure: [
>         Transcript cr; show: 'outer1'.
>         [nil error: 'aiee'] ensure: [Transcript cr; show: 'inner'].
>         Transcript cr; show: 'outer2'.
>       ]
>     ] fork
>
> Expected output:
>
>     outer1
>     (debugger appears; click 'abandon')
>     inner
>
> (or possibly:
>
>     outer1
>     (debugger appears; click 'abandon')
>     inner
>     outer2
>
> which is what you get if you change "Processor activeProcess terminate"
> to "1 + 2" above... but this also seems odd.)
>
> Actual output:
>
>     outer1
>     (no debugger appears, nothing more happens)
>
> Are my expectations out-of-line, or is there a problem worth
> investigating here?
>
> "--"
>
> I think it's worth noting that a related program:
>
>     [
>       [Processor activeProcess terminate] ensure: [
>         [
>           Transcript cr; show: 'outer1'.
>           [nil error: 'aiee'] ensure: [
>             Transcript cr; show: 'inner'].
>           Transcript cr; show: 'outer2'.
>         ] on: Error do: [:ex | Transcript cr; show: ex]
>       ]
>     ] fork
>
> yields the reasonable output
>
>     outer1
>     Error: aiee
>     inner
>
> Cheers,
>   Tony
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220707/7403b9a6/attachment.html>


More information about the Squeak-dev mailing list