=?iso-8859-1?Q?=5BREBOL=5D_R=E9f=2E_:_=5BREBOL=5D_Context_misery?=
[1/2] from: ingo::2b1::de at: 5-Jun-2001 14:48
Hi Vincent,
this is a little shorter, now we need someone who's clever
enough to catch the variable in th local context ...
myfunc: func [
BlockName [string!]
/local aa
][
aa: copy [1 2 3]
set to-word BlockName copy aa
print ["aa is " mold aa]
print [BlockName "is" mold get to-word blockname]
]
>> myfunc "test"
aa is [1 2 3]
test is [1 2 3]
>> test
== [1 2 3]
kind regards,
Ingo
Once upon a time [VDEMONGODIN--CER-CA--FR] spoketh thus:
[2/2] from: vdemongodin::cer-ca::fr at: 5-Jun-2001 14:08
=?iso-8859-1?q?R=E9f=2E_=3A_[REBOL]_Context_misery?=
After some tests, i obtain:
myfunc: func [BlockName [string!]
/local aa bb][
aa: copy [1 2 3]
bb: append reduce [to-set-word to-word BlockName] [ copy aa]
print ["aa is " mold aa]
print ["bb is " mold bb]
do bind bb 'aa ; < define "context" of aa
]
BlockName is defined in global context, in this case.:
>> myFunc "THISISANEWVARIABLE"
aa is [1 2 3]
bb is [THISISANEWVARIABLE: copy aa]
== [1 2 3]
>> THISISANEWVARIABLE
== [1 2 3]
Vincent.