Halt once

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

Halt once

stepharo
Hi guys

we can do better in terms of comments.

https://pharo.fogbugz.com/f/cases/19193/Halt-once-comment-mega-sucks

In Pharo 60 I tried to use Halt once.

There is no menu to set it up anymore so I looked in the class ... :(

What a supercool and welcoming comment

Halt is provided to support Object>>halt.

once
     | callingContext senderContext node |
     <debuggerCompleteToSender>

resetOnce
      (#haltOnce senders, #inspectOnce senders) do: [ :method |
         method ast sendNodes do: [ :sendNode|
             sendNode removeProperty: #Once ifAbsent: [  ]]]

Not a single comment!
I'm sure that we can do a lot better and think to all the newbies that
will check pharo.

Please comments such methods and class.

Stef

Reply | Threaded
Open this post in threaded view
|

Re: Halt once

stepharo
I submitted this as class comment.



Halt is a special exception provided to support breakpoints as defined
in  Object>>halt.

!! Basic usage

To manually set a breakpoint you can use message halt as follows:
[[[
anObject halt.
]]]
You can also use

[[[
Halt now
]]]

[[[
Halt now: 'With a nice explanation'
]]]

!! Advanced usage
The class Halt supports different halting mechanisms such as
conditionals, based on iteration or simply stopping the first time.

!!! Conditionals

[[[
foo
     ...
     Halt if: #invokedFromThisSelector
]]]

This expression will only stop the execution  of method foo if this
method is in the call chain (is invoked from ) message
invokedFromThisSelector.

[[[
foo
       ...
       Halt if: aBlock
]]]

The execution of foo will stop if aBlock returns true.

!!! Counting
Sometimes we need to stop after a given number of iteration.

[[[
Halt count: 5
]]]



!!! Once
It is really useful sometimes to stop only and only one time

[[[
foo
     ...
     Halt once.
]]]

It will be stopped the first time.
Then if you need to rearm it to stop another time you should use

[[[
Halt resetOnce
]]]



Reply | Threaded
Open this post in threaded view
|

Re: Halt once

philippeback
In reply to this post by stepharo
Why no menu anymore?

Phil

On Sun, Oct 9, 2016 at 9:26 PM, stepharo <[hidden email]> wrote:
Hi guys

we can do better in terms of comments.

https://pharo.fogbugz.com/f/cases/19193/Halt-once-comment-mega-sucks

In Pharo 60 I tried to use Halt once.

There is no menu to set it up anymore so I looked in the class ... :(

What a supercool and welcoming comment

Halt is provided to support Object>>halt.

once
    | callingContext senderContext node |
    <debuggerCompleteToSender>

resetOnce
     (#haltOnce senders, #inspectOnce senders) do: [ :method |
        method ast sendNodes do: [ :sendNode|
            sendNode removeProperty: #Once ifAbsent: [  ]]]

Not a single comment!
I'm sure that we can do a lot better and think to all the newbies that
will check pharo.

Please comments such methods and class.

Stef


Reply | Threaded
Open this post in threaded view
|

Re: Halt once

Ben Coman
In reply to this post by stepharo
On Mon, Oct 10, 2016 at 3:26 AM, stepharo <[hidden email]> wrote:

> Hi guys
>
> we can do better in terms of comments.
>
> https://pharo.fogbugz.com/f/cases/19193/Halt-once-comment-mega-sucks
>
> In Pharo 60 I tried to use Halt once.
>
> There is no menu to set it up anymore so I looked in the class ... :(
>
> What a supercool and welcoming comment
>
> Halt is provided to support Object>>halt.
>
> once
>     | callingContext senderContext node |
>     <debuggerCompleteToSender>

I touched that last so I'll take it on the chin.
I guess there were no comments before I updated it and was complacent
about comments status quo.

Freshening up existing comments (or lack of) hasn't been in the
forefront of my mind, but you are right, modifying an existing method
is a good opportunity to improve comments.

cheers -ben

Reply | Threaded
Open this post in threaded view
|

Re: Halt once

Ben Coman
In reply to this post by philippeback
In Pharo 6 I got stuck on the same and after some delay found it under
the World > Debugger menu.
It would be nice if such rearrangement of UI elements were announced
more obviously on the mail list.
cheers -ben

On Mon, Oct 10, 2016 at 4:38 AM, [hidden email] <[hidden email]> wrote:

> Why no menu anymore?
>
> Phil
>
> On Sun, Oct 9, 2016 at 9:26 PM, stepharo <[hidden email]> wrote:
>>
>> Hi guys
>>
>> we can do better in terms of comments.
>>
>> https://pharo.fogbugz.com/f/cases/19193/Halt-once-comment-mega-sucks
>>
>> In Pharo 60 I tried to use Halt once.

Reply | Threaded
Open this post in threaded view
|

Re: Halt once

Sven Van Caekenberghe-2
Can't Menu Item not be found with Spotter ?

> On 10 Oct 2016, at 02:11, Ben Coman <[hidden email]> wrote:
>
> In Pharo 6 I got stuck on the same and after some delay found it under
> the World > Debugger menu.
> It would be nice if such rearrangement of UI elements were announced
> more obviously on the mail list.
> cheers -ben
>
> On Mon, Oct 10, 2016 at 4:38 AM, [hidden email] <[hidden email]> wrote:
>> Why no menu anymore?
>>
>> Phil
>>
>> On Sun, Oct 9, 2016 at 9:26 PM, stepharo <[hidden email]> wrote:
>>>
>>> Hi guys
>>>
>>> we can do better in terms of comments.
>>>
>>> https://pharo.fogbugz.com/f/cases/19193/Halt-once-comment-mega-sucks
>>>
>>> In Pharo 60 I tried to use Halt once.
>


Reply | Threaded
Open this post in threaded view
|

Re: Halt once

stepharo
In reply to this post by Ben Coman
I improved all the comments that I could. Now this is better. especially
since the new version in Ph6.0

do not need to be restarted.


Stef


Le 10/10/16 à 02:08, Ben Coman a écrit :

> On Mon, Oct 10, 2016 at 3:26 AM, stepharo <[hidden email]> wrote:
>> Hi guys
>>
>> we can do better in terms of comments.
>>
>> https://pharo.fogbugz.com/f/cases/19193/Halt-once-comment-mega-sucks
>>
>> In Pharo 60 I tried to use Halt once.
>>
>> There is no menu to set it up anymore so I looked in the class ... :(
>>
>> What a supercool and welcoming comment
>>
>> Halt is provided to support Object>>halt.
>>
>> once
>>      | callingContext senderContext node |
>>      <debuggerCompleteToSender>
> I touched that last so I'll take it on the chin.
> I guess there were no comments before I updated it and was complacent
> about comments status quo.
>
> Freshening up existing comments (or lack of) hasn't been in the
> forefront of my mind, but you are right, modifying an existing method
> is a good opportunity to improve comments.
>
> cheers -ben
>
>