[REBOL] Re: view indirection
From: ingo:2b1 at: 20-Nov-2001 19:43
Hi Patrick,
Once upon a time Patrick Philipot spoketh thus:
> set-check: func [n [integer!] /local code ][
> code: copy ""
> code: join join "set in c" n join " 'data true show c" n
> print ["generated code ; " code]
> do code
> ]
>
> IT IS WORKING ! (the print is only for debugging purpose). However I am not satisfied
with this code. I'am looking for a more elegant way to do that. Something like :
>
> myCheckBox: guru-function( "c" 5)
> myCheckbox/data: true
how about that one?
>> c1: make object! [data: none]
>> probe c1
make object! [
data: none
]
>> guru-function: func [ s [string!] n [integer!]][
[ get to-word join s n
[ ]
>> mc: guru-function "c" 1
>> mc/data: "yup"
== "yup"
>> probe c1
make object! [
data: "yup"
]
And how 'guru-function works:
'join the string (s) and the integer (n)
make a word out of it
and get what you find under that word (without the 'get
it would only return the name of the word 'c1, namely a
word c1. With 'get, it returns the object!, c1 points too).
I hope that helps
Ingo