[REBOL] Re: [REBOL][Debug] How best to debug REBOL?
From: Christophe::Coussement::mil::be at: 3-May-2004 9:25
There are several classical ways of debugging REBOL, but -not talking about 'trace- they
are all 'print-like: take a look at ?, ?? and probe.
>> ? ??
Prints a variable name followed by its molded value. (for debugging)
?? is a function value.
name -- (Type: any)
>> ? ?
Prints information about words and values.
? is a function value.
word -- (Type: any-type)
>> ? probe
Prints a molded, unevaluated value and returns the same value.
PROBE is a function value.
value -- (Type: any)
We are using a more sophisticated way of debugging, although also 'print-like.
We place some specific debug-instructions within the code, according the effect we want
to reach: examine the content of a word, set a mark, evaluate some code, stop the evaluation
of the script, etc.... The interesting part is that those debug-instructions are like
comments, so they don't interact with the script when evaluated or encapsulated:
1. your script...
at the place you want a debug action:
;$debug => gives value of all user words
;$debug/var 'var1 => gives only value of var1
;$debug/var [var1 var2] => gives only value of var1 & var2
;$debug/stop => request pause after displaying var value
;$debug/eval [some rebol code] ;=> eval code into block
;$debug/prn 'var or [var] ;=> print the molded value
;$debug/mark 'val ;=> set a milestone
(use /exe as alone refinement !)
2. calling the debug script...
from the console:
do/args %debug.r %yourscript.r
do %debug.r => the file to debug will be requested
We use it daily in our developments :)
I could provide you a copy if you are interested. Just send me your email.