[squeak-dev] The Inbox: Kernel-nice.1391.mcz

Jaromir Matas m at jaromir.net
Sat Apr 24 19:32:00 UTC 2021


Hi Nicolas,

> Remove the questionable ifCurtailed: block that did reactivate the handler
> in handleSignal:, and 
> make the handling symetric, whether the handlerAction explicitily use
> exception return or not.

I'd like to suggest the following change to really make handling `return`
the same whether it's called explicitly or not: The last line should send
`return: val` to exception instead of self - the `exception return` calls
`handlerContext return` and at the moment it's true the `self` is the
handlerContext. But in theory someone can e.g. change `return` definition
and then the two returns won't be the same... Plus I think this is more
consistent and readable. Thanks,

handleSignal: exception
	"Sent to handler (on:do:) contexts only.  If my exception class (first arg)
handles exception
	 and the handler is active then execute my handle block (second arg),
otherwise forward
	 this message to the next handler context.  If none left, execute
exception's defaultAction
	 (see nil>>handleSignal:)."

	| val |
	(self willHandleSignal: exception) ifFalse:
		[self deactivateHandler.
		^self nextHandlerContext handleSignal: exception].

	exception privHandlerContext: self contextTag.
	self deactivateHandler.  "disable self while executing handle block"
	val := self fireHandlerActionWith: exception.
+	exception return: val  "return as default action if not otherwise directed
in handle block"
-	self return: val  "return from self if not otherwise directed in handle
block"




-----
^[^ Jaromir
--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html


More information about the Squeak-dev mailing list