[REBOL] Re: [Function] with [Variable number of args]
From: maximo:meteorstudios at: 5-Apr-2004 20:26
> I have already seen somebody here redefine the REBOL PRINT
> for use its own PRINT substitute with extensions instead and
> when leaving
> his own context put back the normal PRINT so everything seems
> normal after.
slim includes (as part of its basic toolset) a very advanced print mechanism, which allows
you indent every part of the code you are using.
vprint/vprobe also can be swicthed on and off run-time so that you can only see print
statements when you need them, yet still leave them in the code for future debugging.
because each slim uses its own context, you can switch the vprint on and off for each
module separately and this allows you to debug ONLY the part of the code you are working
on.
I give a simple example of an indented output in the console, when verbose is set to
on:
pane/gl-layout(none : 108x110)
------------------------
----- ROOT PANE ----
------------------------
pane/gl-layout(none : 106x108)
pane/gl-layout(none : 104x106)
gl.text/gl-layout(Packages: 102x22)
]
]
pane/gl-layout(none : 102x56)
pane/gl-layout(none : 80x56)
pane/gl-layout(none : 80x40)
gl.text/gl-layout(: 80x20)
]
]
gl.text/gl-layout(test-a.r: 80x20)
]
]
]
]
gl.box/gl-layout(none: 80x16)
]
]
in this example, the print statements in the functions themselves where silenced, but
you still a clean diagram of program flow and can easily identify an error...
all slim modules get the vprint system added at load time... so you don't have to fiddle
around with any of this... its free and its completely hands off... you only have to
use vprint instead of print and add the /in and /out refinement whenever you want to
indent code (which is usually at the begining of a function or a loop, and at the end
of these.
also note that all modules cooexist as part of the indentation, so different modules
using vprint, will all indent cleanly!
also note that this system uses the global print, leaving you to do your own complimentary
tricks... as usual... like saving to a log... yep... you get indented logs...
sorry for this shameless plug ;-)
-MAx