On Nov 30, 2009, at 10:51 PM, Henrik Sperre Johansen wrote:

> On 30.11.2009 22:06, Schwab,Wilhelm K wrote:
>> 
>>  
>> (2) Debugging drawing code is probably best done using a single-shot 
>> breakpoint.  I _think_ I have seen something about halt once in Pharo.  
>> FWIW, somebody posted a class called Once that creates such a feature that 
>> looks like
>>  
>>    Once do:[
>>       "do anything here, but this is common:"
>>       self halt.
>>    ].
>>  
>> Somewhere you need to do Once reset or something (it's obvious from the 
>> code) to enable the breakpoint.  Once evaluates the block one time, and then 
>> won't evaluate the block again until told to do so.  If there is a need for 
>> this in Pharo, I should be able to "port" it - IIRC, it was licensed for 
>> public consumption.
> It exists already, is called haltOnce, and is used in the same manner as 
> halt. To arm it, evaluate Object setHaltOnce. Make sure to remove them when 
> you finish debugging though, since the overhead is non-negligible.

In addition, I added a trivial version of  "contextual" or "subjective" halt 
feature to #haltIf:. It looks up the stack and only halts if there is a method 
with the name if the parameter
is a symbol.

Thus you can do:

        self haltIf: #testThatIWrote 

Of course,  at some point (years, not days, I fear) we will make the deep 
principle that is hidden in this idea a core feature of the reflective model...

        Marcus
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to