Hi Eliot,
In 2009 you forwarded #cannotReturn: to #cannotReturn:to: to signal BCR rather than just open a debugger. I can't figure out why you made the forwarding conditional:
closureOrNil notNil ifTrue: [^self cannotReturn: result to: self home sender].
QUESTION: why signal BCR for illegal block returns only and not all
Unless there is a reason I overlooked, why not simplify #cannotReturn: like this:
cannotReturn: result
self cannotReturn: result to: self home sender. self error: 'Computation has been terminated!'
All tests are green but that doesn't mean much; I'd be very grateful if you could help me clarify the above question.
Many thanks, Jaromir
-- Jaromir Matas mail@jaromir.net
Hi Jaromir,
at least, we would have to rename BlockCannotReturn into CannotReturn in this case. :-) Also, deadHome will always be nil in this case. Lastly, there will never be an exception handler for BCR on the stack when the method itself has no sender. But I think you are right, nothing would hinder us from always choosing the more idiomatic way to raise an error ... at least I hope?
Maybe test this change in your image for a couple of weeks and if your image never freezes, implement this in the trunk? :-)
Best, Christoph
--- Sent from Squeak Inbox Talk
On 2023-12-11T08:47:20+00:00, mail@jaromir.net wrote:
Hi Eliot,
In 2009 you forwarded #cannotReturn: to #cannotReturn:to: to signal BCR rather than just open a debugger. I can't figure out why you made the forwarding conditional:
closureOrNil notNil ifTrue: [^self cannotReturn: result to: self home sender].
QUESTION: why signal BCR for illegal block returns only and not all
Unless there is a reason I overlooked, why not simplify #cannotReturn: like this:
cannotReturn: result
self cannotReturn: result to: self home sender. self error: 'Computation has been terminated!'
All tests are green but that doesn't mean much; I'd be very grateful if you could help me clarify the above question.
Many thanks, Jaromir
-- Jaromir Matas mail(a)jaromir.net
squeak-dev@lists.squeakfoundation.org