[REBOL] Re: Looking over the horizon - Rebol 3
From: Steven:White:ci:bloomington:mn:us at: 10-Nov-2003 14:37
>>> [ingo--2b1--de] 11/10/03 01:23PM >>>
>
> I would like my script to be able to obtain a list of all the words
> that I created when I wrote the script.
<...>
>Do you mean something like this?
>> query/clear system/words
== [end! unset! error! datatype! context! native! action! routine! op!
function! object! struct! library! port! any-type! any-word!...
>> a: 2
== 2
>> set 'b "hi"
== "hi"
>> c: func[][print 'done]
>> query system/words
== [c a b]
*_*_*_*_*_*_*_*_*_*
I do not think so. In the example below, MY-WORDS is a block listing
the words that I have created in the script. The function
FORMATTED-MEMORY-DUMP prints the values of those words. In order for
FORMATTED-MEMORY-DUMP to know what words and values to print, I had to
specify the words in the block MY-WORDS.
If the words in the block MY-WORDS could be obtained from the REBOL
interpreter, then the function FORMATTED-MEMORY-DUMP could be modified
to be used in any script, and I would not have to provide a list of
words to be "dumped." (MY-WORDS). In addition, if I modified the
script, and added DATA-NAME-4, the FORMATTED-MEMORY-DUMP procedure would
list the new item without me having to make any coding changes.
I believe someone on this list mentioned an un-implemented concept of
system/script/words that would, if implemented by RT, solve this.
*_*_* SAMPLE SCRIPT
REBOL []
MY-WORDS: [ DATA-NAME-1 DATA-NAME-2 DATA-NAME-3 ]
DATA-NAME-1: [swhite--ci--bloomington--mn--us]
DATA-NAME-2: "THIS IS A TEST"
DATA-NAME-3: 156
FORMATTED-MEMORY-DUMP: does [
foreach MY-WORD MY-WORDS [
PRINT [ MY-WORD
" is of type " type? get MY-WORD
" and is equal to " get MY-WORD ]
]
]
FORMATTED-MEMORY-DUMP
*_*_*__ END OF SAMPLE
Steven White
City of Bloomington
1800 W Old Shakopee Rd
Bloomington MN 55431-3096
USA
952-563-4882 (voice)
952-563-4672 (fax)
[steven--white--ci--bloomington--mn--us]