Hi again,

okay, trying in VAST didn't shed much light, because resignalAs: is implemented as

^self error: 'Not yet implemented'.

;-)))

But here is an excerpt from the method's comment:

    Synopsis:
        Signal an alternative exception in place of the receiver.

     Definition: <signaledException>
The active exception action is aborted and the exception environment and the evaluation context are restored to the same states that were in effect when the receiver was originally signaled.

Restoring the evaluation context may result in the execution of #ensure: or #ifCurtailed:
        termination blocks.

After the restoration, signal the replacementException and execute the exception action as
        determined by the restored exception environment.

This message causes the replacementException to be treated as if it had been originally
        signaled instead of the receiver.

If the replacementException is resumable and its exception action resumes, control will ultimately return from the message that signaled the original exception.

Control does not return from this message to the currently active exception action.


If I understand correctly, the [1/0] should only be run once and never again, and you should get a NotFound error.

....But:

In VisualWorks, I also get a Halt instead of a MustBeBoolean (I had to Replace NotFound with something available in VW, so I used MustBeBoolen).


So I am puzzled... Hoping for someone to shed some light on this...

Joachim



Am 24.07.15 um 08:25 schrieb [email protected]:
Definitely looks wrong to me... The catching block shouldn't catch exceptions in itself, and a resignal should never run the block again...

I'll try this in VAST.


Am 23.07.15 um 20:05 schrieb Norbert Hartl:
You get a debugger at the position if the halt in the code. Meaning the exception block run more than once. And it would run forever.

Norbert



Am 23.07.2015 um 18:46 schrieb Joachim Tuchel <[email protected]>:

Norbert,

Sorry if this is a stupid question: what does the debugger say?

I mean, assuming NotFound is an Exception, I'd expect a debugger showing a NotFound Error...

Joachim

Am 23.07.2015 18:34 schrieb Norbert Hartl <[email protected]>:

Am 23.07.2015 um 17:54 schrieb Joachim Tuchel <[email protected]>:

Norbert,

I'd say you get a NotFound Exception.
In pharo you get a debugger. Meaning this piece of code is actively an endless loop.

Norbert

Joachim



Am 23.07.2015 um 16:20 schrieb Norbert Hartl <[email protected]>:

What are the semantics of Exception>>#resignalAs: regarding active exception handler? Isn't the active exception handler excluded from being treated again? Taking the example

| counter |
counter := 0.
[ 1/0 ]
    on: Error
    do: [ :e |
        counter := counter + 1.
        counter > 1 ifTrue: [ self halt ].
        e resignalAs: NotFound new ].

should it just run and end? Or should the debugger pop up?

thanks,

Norbert






--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:[email protected]
Fliederweg 1                         http://www.objektfabrik.de
D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1


Reply via email to