[REBOL] Re: Context misery
From: carl:rebol at: 5-Jun-2001 10:02
Ah, but what are you really trying to do?
From your example, the variable is not really dynamic
(because you use exactly the string you pass in for it.)
So, just pass the name as a name.
myfunc: func [name] [set name copy [1 2 3]]
myfunc 'example
print example
That will allow 'example to be part of any context,
including objects and locals to functions.
You can also use the shorthand:
myfunc: func ['name] [set name copy [1 2 3]]
myfunc example
print example
And, if you need "code" as part of it:
myfunc: func [name code] [set name do code]
myfunc 'example [1 + 2]
print example
You get the idea,
-Carl