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

[REBOL] Re: Trace function

From: sanghabum:aol at: 21-Jun-2001 12:34

[chris--starforge--demon--co--uk]:
> Heh, makes me feel like a luddite! I mainly write cgi scripts, so I > usually just bung in things like > > print rejoin [ "<!-- " foo " " bar " " foogle " -->" ] ; NUKE ME!!! > > and then just strip all the "; NUKE ME!!!"s when I'm done testing...
Hi Chris, You reminded me that (months ago) when I was doing some CGI work, I wrote a short debugging print function: ========= Rebol [] debugPrint: func [db [any-type!]] [ prin "<!-- " either error? try [prin type? db] [prin "[type?] "] [prin " "] either error? try [prin length? db] [prin " [length?] "] [prin " "] either error? try [prin mold db] [prin " [item?] "] [prin " "] print " -->" return true ] ========= Examples:
>> debugprint [carl--rebol--com]
<!-- email 14 [carl--rebol--com] -->
>> debugprint system/stats
<!-- integer [length?] 3841120 -->
>> debugprint reduce [red white blue]
<!-- block 3 [255.0.0 255.255.255 0.0.255] -->
>> debugprint try [do " 8 / 0"]
<!-- error [length?] [item?] --> (The last example showing that it could do with a bit more datatype awareness). Of course it can be disabled using Joel's nifty redefinition: debugprint: func [dummy [any-type!]] [] --Colin.