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

Jaromir Matas m at jaromir.net
Wed Apr 28 13:48:22 UTC 2021


Hi All,


Jaromir Matas wrote
> 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"

Please disregard the above proposal - it leads to an incorrect #outer
behavior. Unfortunately it passes all the tests which shouldn't happen and I
sent a fix to the Inbox to update the outer test:
http://forum.world.st/The-Inbox-Tests-jar-454-mcz-td5129221.html

best,



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


More information about the Squeak-dev mailing list