[squeak-dev] The Inbox: Kernel-jar.1446.mcz

mail at jaromir.net mail at jaromir.net
Sun Feb 6 10:39:49 UTC 2022

I forgot to mention the proposed fix is complemented with a set of tests in Tests-jar.464

Also, my previous attempt to solve this in Kernel-jar.1407 can be removed from the Inbox.

Sent from Squeak Inbox Talk

On 2022-02-06T10:37:48+00:00, commits at source.squeak.org wrote:

> A new version of Kernel was added to project The Inbox:
> http://source.squeak.org/inbox/Kernel-jar.1446.mcz
> ==================== Summary ====================
> Name: Kernel-jar.1446
> Author: jar
> Time: 6 February 2022, 11:37:44.367834 am
> UUID: 8598d7f7-f9c4-b648-b9da-378d98b37ae2
> Ancestors: Kernel-mt.1443
> fix Exception >> signal behavior when signaling an already signaled exception; see discussion in http://lists.squeakfoundation.org/pipermail/squeak-dev/2022-February/218861.html
> Originally there was no check if the receiver has already been signaled which was a bug (subsequent #signal sends to an already signaled exception lead to weird errors); last year I suggested making such a send equivalent to sending #outer but that's a poor fix which is not even compliant with ANSI; this latest approach is both compliant and makes the following example work and pick up the ZeroDivide handler as one might expect:
> [1/0] on: Error do: [:ex | 
> 	[ex signal] on: ZeroDivide do: [Transcript show: #ZeroDivide]
> 	]
> =============== Diff against Kernel-mt.1443 ===============
> Item was changed:
>   ----- Method: Exception>>signal (in category 'signaling') -----
>   signal
> + 	"Ask ContextHandlers in the sender chain to handle this signal.  The default is to execute and return my defaultAction.
> + 	Sending #signal to an already signaled exception generates a new exception of the same type with the same messageText"
> - 	"Ask ContextHandlers in the sender chain to handle this signal.  The default is to execute and return my defaultAction."
> + 	signalContext ifNotNil: [^self class signal: messageText]. 
> - 	signalContext ifNotNil: [^self outer]. "re-signalling an already signalled exception is equivalent to sending #outer"
>   	signalContext := thisContext contextTag.
>   	^(thisContext nextHandlerContextForSignal: self) handleSignal: self!

More information about the Squeak-dev mailing list