Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: [REBOL][Debug] How best to debug REBOL?

From: Christophe::Coussement::mil::be at: 3-May-2004 9:25

Hi Tony, There are several classical ways of debugging REBOL, but -not talking about 'trace- they are all 'print-like: take a look at ?, ?? and probe.
>> ? ??
USAGE: ?? 'name DESCRIPTION: Prints a variable name followed by its molded value. (for debugging) ?? is a function value. ARGUMENTS: name -- (Type: any)
>> ? ?
USAGE: ? 'word DESCRIPTION: Prints information about words and values. ? is a function value. ARGUMENTS: word -- (Type: any-type)
>> ? probe
USAGE: PROBE value DESCRIPTION: Prints a molded, unevaluated value and returns the same value. PROBE is a function value. ARGUMENTS: 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 or 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. Regards, ==christophe [christophe--coussement--mil--be]