Debugging block with ensure block

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Debugging block with ensure block

kurs.jan
Hi,

I observe a strange behaviour (in Pharo-1.4-14557-one-click.app) while debugging the following code.

[
        | a |
        self halt.
        a := (1 == 1).
       
        a ifTrue: [ ^ 'A'] .
        Transcript crShow: 'foo'.
        ^ 'B'
       
] ensure: [
        Transcript crShow: 'bar'.
]

If I comment out the halt statement and if I inspect the result of the attached code, the 'A' is returned and there is a 'bar' text in the transcript.
If I inspect the result of the attached code (with halt enabled) and if I click step over in a debugger, I can see, that the statement ^ 'A' does NOT return, the program flow continues on the next line and the 'foo' is shown in the transcript. Now, I can click proceed and the 'B' is returned as a result.
I tried the same process in Pharo-1.3-13328-OneClick.app and I got 'A' result in both cases.


I tried on this system:
System Version: Mac OS X 10.7.3 (11D2001)
Kernel Version: Darwin 11.3.0

Regards,
Jan
Reply | Threaded
Open this post in threaded view
|

Re: Debugging block with ensure block

Sven Van Caekenberghe
Hi Jan,

On 24 Jul 2012, at 13:34, kurs.jan <[hidden email]> wrote:

> I observe a strange behaviour (in Pharo-1.4-14557-one-click.app) while
> debugging the following code.
>
> [
> | a |
> self halt.
> a := (1 == 1).
>
> a ifTrue: [ ^ 'A'] .
> Transcript crShow: 'foo'.
> ^ 'B'
>
> ] ensure: [
> Transcript crShow: 'bar'.
> ]
>
> If I comment out the halt statement and if I inspect the result of the
> attached code, the 'A' is returned and there is a 'bar' text in the
> transcript.
> If I inspect the result of the attached code (with halt enabled) and if I
> click step over in a debugger, I can see, that the statement ^ 'A' does NOT
> return, the program flow continues on the next line and the 'foo' is shown
> in the transcript. Now, I can click proceed and the 'B' is returned as a
> result.
> I tried the same process in Pharo-1.3-13328-OneClick.app and I got 'A'
> result in both cases.

Strange, I just tried on Pharo 2.0 and it worked as expected.

Sven

Reply | Threaded
Open this post in threaded view
|

Re: Debugging block with ensure block

kurs.jan
Hi,
same for me. It seems to be bug in 1.4 Summer release only.

Jan