Eliot Miranda uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-eem.1535.mcz
==================== Summary ====================
Name: Kernel-eem.1535 Author: eem Time: 20 November 2023, 5:05:17.734241 pm UUID: 44f1833a-15d0-4166-b361-293c85a40e0b Ancestors: Kernel-mt.1534
On a block cannot return error capture the pc of the failing return bytecode and mark the block context dead (nil its pc) so that computation cannot continue to any invalid state.
=============== Diff against Kernel-mt.1534 ===============
Item was changed: Error subclass: #BlockCannotReturn + instanceVariableNames: 'pc result deadHome' - instanceVariableNames: 'result deadHome' classVariableNames: '' poolDictionaries: '' category: 'Kernel-Exceptions'!
!BlockCannotReturn commentStamp: '<historical>' prior: 0! This class is private to the EHS implementation. Its use allows for ensured execution to survive code such as:
[self doThis. ^nil] ensure: [self doThat]
Signaling or handling this exception is not recommended.!
Item was added: + ----- Method: BlockCannotReturn>>pc (in category 'accessing') ----- + pc + + ^ pc!
Item was added: + ----- Method: BlockCannotReturn>>pc: (in category 'accessing') ----- + pc: pcIndex + + pc := pcIndex!
Item was changed: ----- Method: Context>>cannotReturn:to: (in category 'private') ----- cannotReturn: result to: homeContext + "The receiver tried to return result to homeContext that no longer exists. + Capture the return pc in a BlockCannotReturn. Nil the pc to prevent repeat + attempts and/or invalid continuation. Answer the result of raising the exception." - "The receiver tried to return result to homeContext that no longer exists."
+ | exception | + exception := BlockCannotReturn new. + exception - ^ BlockCannotReturn new result: result; deadHome: homeContext; + pc: self previousPc. + pc := nil. + ^exception signal! - signal!
packages@lists.squeakfoundation.org