[REBOL] debugging an object
From: tim::johnsons-web::com at: 12-Sep-2003 15:14
Hello Rebols:
I'm attempting to write a debug function
which will print out both a data member of an object
and the object name (but not the rest of the objects,
methods etc).
And if it is not an object, just do a simple print-out
as in '??
Given the following code:
; ======================================================================================
obj: context[
_blk_: ["one" 1 "one" 2 "two" "" 1 "here"]
]
dbg: func [ 'name ][
either system/options/cgi/server-name[print <pre>][prin ""]
either all[object? name (in name '_blk_)][
print [ head insert tail form name reduce [": " mold get in name '_blk_] ]
][
print either word? :name
[ head insert tail form name reduce [": " mold name: get name] ]
[ mold :name ]
]
; ====================================================================================
;where
>> some-number: 2
== 2
>> dbg some-number ; just like '??
some-number: 2 ; okay, that's good
>> dbg obj
obj:
make object! [
_blk_: ["one" 1 "one" 2 "two" "" 1 "here"]
]
; that's more than I want to see, really
>> dbg :obj
?object?: ["one" 1 "one" 2 "two" "" 1 "here"]
; Now that's closer, but what I really want to do
; would be
dbg obj
obj: ["one" 1 "one" 2 "two" "" 1 "here"]
any suggestions?
Thanks
tim
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.alaska-internet-solutions.com
http://www.johnsons-web.com