[REBOL] Re: Improved SOURCE function
From: carl:cybercraft at: 6-May-2001 17:59
On 06-May-01, Blaz Segavac wrote:
> 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...
> == 126.96.36.199.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?
I wouldn't blame Larry's code for the "no further output". As he says
above, if you don't give it a path it defaults to 'source, and
will probably give you the same result. I eventually
just get a not-enough-memory error. (Though that's one REBOL error I
agree with in my computer's case, but it's probably not the case with