[REBOL] intersting side-effect to dynamic word usage...
From: media:quazart at: 15-Nov-2001 9:57
What I am about to point out might be common knowledge to some of you but in
the hopes that this will be usefull to someone, I explain it anyways...
Basically, there is a side-effect to using 'to-word and more specifically
here is a little piece of code which illustrates this. I have added some
comments in-line in the code so that I can explain just what happens as the
I have used Romano's excelent anamonitor.r script to give visual feedback of
exactly what happens... to run the code below, download his script (if its
not already in your favorite downloads) and just change the path so that it
can be loaded. Otherwise, just read the comments in the code, as these
explain what happens if you do not wish to run the example.
------------ code follows -----------------
;----------- LOAD Romano's object/block browser
do load %/your/path/to/romanos/anamonitor.r
dynamic-word: ask "WHAT IS NEW WORD TO ADD? :"
; let's say we answered "aaa", we now append this string to our word-block
append aaa-block to-set-word dynamic-word
;---------- AT THIS POINT IN EXECUTION,
; something funky happens...
; the set-word exists within the block which is now set as [aaa:]
; this is expected...
; a word is ALSO set inside the system/words block and is set to
; I just thought I'd note this as it might interest some of you
; check it out:
; here I just set the value (WITHOUT USING the word's name in the code)
set in system/words to-word form first aaa-block "MAMA!"
print to-word form first aaa-block
Anyways, this is just a quick trick I found out... the above also seems to
stand if you use the to-word function .... which also seems to instantly
add the word in system/words, even if you're inserting it in a block