[squeak-dev] order of ensure: processing vs. error handling
Chris Muller
asqueaker at gmail.com
Mon Sep 5 22:02:03 UTC 2016
Thank you. That makes perfect sense, when the Error is signaled, it must
enter into the handler *deeper* in the stack (not unwound), and so of
course its still IN the first part of the #ensure: method (valuing
itself). Got it.
@Chris: If I were you, I wouldn't bother with such magic. Instead, I'd use
> a linear approach:
>
> | isTheFileOpen |
> isTheFileOpen := false.
> [ try the first method. isTheFileOpen := true ] ifError: [].
> isTheFileOpen ifFalse: [
> [ try the second method. isTheFileOpen := true ] ifError: [].
> isTheFileOpen ifFalse: [
> [ try the third method. isTheFileOpen := true ] ifError:
> [].
> ... ] ].
Yes, I'll have to go sequential.
PS -- I don't care to use ifError: because it doesn't give me access to the
Exception object, only its description and receiver. I think it should
more closely mirror on: Error do: [ :err | ... ].
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20160905/b4673799/attachment.htm
More information about the Squeak-dev
mailing list
|