Formatted memory dump
[1/2] from: Steven::White::ci::bloomington::mn::us at: 29-Aug-2003 10:40
Speaking of system words, is there any way a REBOL script can get its
hands on the user-defined words in itself, without hard-coding them?
In other words, if I wanted to make a formatted "memory dump" to
display when some error occurs, I could say
print <word-1>
print <word-2>...
print <word-n>
and write a module like this for every script, with "word-n" being each
word in the script. BUT, if the script itself could find those words
in some system area, THEN I could write ONE general-purpose module that
I could put into ANY script, and when I called it I would get a listing
of all the word in the script with their current values.
Thank you.
Steven White
City of Bloomington
2215 W Old Shakopee Rd
Bloomington MN 55431-3096
USA
952-563-4882 (voice)
952-563-4672 (fax)
[swhite--ci--bloomington--mn--us]
[2/2] from: g:santilli:tiscalinet:it at: 29-Aug-2003 18:00
Hi Steven,
On Friday, August 29, 2003, 5:40:29 PM, you wrote:
SW> Speaking of system words, is there any way a REBOL script can get its
SW> hands on the user-defined words in itself, without hard-coding them?
Well, in theory this should be the purpose of SYSTEM/SCRIPT/WORDS,
but AFAIK this is not implemented. However, as long as you can do
a QUERY/CLEAR on SYSTEM/WORDS before DOing the script, you can see
what words have been modified by evaluating the script using QUERY
on SYSTEM/WORDS. I.e.:
query/clear system/words
; now do a script
do %my-script.r
; let's see what words have been modified by the script:
modified-words: query system/words
; now you could print them like in your example
foreach word modified-words [print word]
HTH,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/