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

m at jaromir.net m at jaromir.net
Thu Nov 4 10:25:34 UTC 2021


Hi Tony,

earlier this year I reworked #terminate fixing multiple bugs - try merging Kernel-jar.1414 from the Inbox into your image and your example should behave as expected :)

I've been waiting for some reviews and hopefully integrating the above final version into the Trunk. We have some unfinished discussions with Christoph but they are more or less on top of the proposed Kernel-jar.1414.

Thanks for posting this interesting example!
best,

^[^ Jaromir
 ---

Sent from Squeak Inbox Talk

On 2021-11-04T09:59:05+01:00, tonyg at leastfixedpoint.com 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
> 
> 


More information about the Squeak-dev mailing list