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

commits at source.squeak.org commits at source.squeak.org
Fri May 6 13:24:41 UTC 2022


Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/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