[Newbies] halt is cool !
Ron Teitelbaum
Ron at USMedRec.com
Wed May 10 12:17:59 UTC 2006
_______________________________________
> 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 at USMedRec.com
More information about the Beginners
mailing list