[REBOL] Re: Improved SOURCE function
From: blazs:orac:au at: 6-May-2001 14:16
Hello Larry
On 06-May-01, Larry Palmiter wrote:
> Hi all,
>
> I got tired of the SOURCE function not working for items inside
> objects, so I wrote an improved version SRC which will do so. When
> the argument is not a path, it simply calls SOURCE. I stole the hard
> part of the code from Doc Kimbel's most excellent extended help
> function which is also an object browser. Doc may be interested in
> adding a refinement (like help/s arg) which would cause it to
> display the source for items in objects. Meanwhile you can use my
> function. If you like it, just invoke the script below in your
> user.r script.
>
> Here are some examples:
>
>>> src rebol/view/vid/track
> track: func [blk][if verbose [print blk]]
>
>>> src rebol/view/vid/verbose
> verbose: false
>
>>> src ctx-viewtop/dbug
> dbug: func [msg [block! any-string!] /local dbg][
> if not dbg: user-prefs/debug [exit]
> msg: head insert remold msg "desktop "
> either file? dbg [write/append dbg msg] [print msg]
> ]
>
>>> src cosine
> cosine: native [
> "Returns the trigonometric cosine in degrees."
> value [number!]
> /radians "Value is specified in radians."
> ]
>>>
>
I grabbed the src.r script, put it in my rebol directory, and ran
src.r, with the following result...
>> system/version
== 1.1.0.1.1
>> src system
<no further output>
I presume 'src should put out an error message of some sort or does it
actually try to display what source it can find within 'system?
> Enjoy
> -Larry
>
Regards
Blaz