Hi all
I'm rediscovering halt and finding it excellent...
So I just send this mail to see how people use it... etc etc...
self halt allows to interurpt code and open a debuger then we're able: - to inspect all objects (really useful for objects that are not inspectable in a workspace like seaside component) - follow code message flow (over get to the new one - inside go in the sent message code - through enter code in a block) : it took me time to use it (nearly) properly - to code directly in the debugger ! (didn't do before but what a time saver ! I put self halt in some empty method and then you can write code (autocompletion works too :) ), then saving revert the current method that you can follow to see if it's doing what's expected :) :) really really great ! why I didn't use that before ;)
Noury sent a mail about self haltOnce to avoid recursion
First you should enable halt once (message setHaltOnce). More in category 'debugging-haltOnce' in Object. never used though ;)
If you have any other remarks concerning the use of halt.. or other related "tool"...
See you
Cédrick
One of the differences between Smalltalk and most of the systems that have come after it is that Smalltalk is completely live. "halt" is cool because it shows us how much more alive Smalltalk is than other systems. You can put "self halt" in some code when you don't know what it is supposed to do and then write the code knowing the context it is executing in. I tend not to use "self halt" for this, but instead "self error: 'write me'" because sometimes I don't find the spot for a few days and it is nice to have the error message to remind me what I was supposed to do.
-Ralph
_______________________________________
From: cdrick Sent: Wednesday, May 10, 2006 5:26 AM
If you have any other remarks concerning the use of halt.. or other related "tool"...
Here is a nice trick to allow you to debug a multiple levels.
Object >> halt0 "halt if the global variable Debugging is set to a number less then or equal to 0" ^self haltN: 0
Object >> haltN: aDebuggingLevel "halt if the global variable Debugging is set to a number less then or equal to aDebuggingLevel" (Debugging notNil and: [Debugging <= aDebuggingLevel]) ifTrue: [^self halt]. ^self
You could then create halt1 halt2 and place them at great levels of detail, where halt0 is in main starting methods, and halt1 is more detailed deeper methods ...
To enable the halts you simply do the following on a workspace
Debugging := 0. and when it asks set Debugging to a global variable. Use 1 for more through debugging.
This was very helpful for me but I found I never really went past halt1. Also I left these in my code but for production applications I placed a halt handler on my application that proceeded so that users couldn't halt my applications with a keyboard short cut, by setting debugging, or if a developer accidentally released code with a halt in it. (don't laugh it has happened more then once!)
Hope that helps!!
Ron Teitelbaum President / Principal Software Engineer US Medical Record Specialists Ron@USMedRec.com
beginners@lists.squeakfoundation.org