Hello [EMAIL PROTECTED]!
On 16-Giu-00, you wrote:
G> p.s. Is there any way to do the same thing, even if
G> "result" were a local var and not global?
You can set r/result to whatever; but perhaps you are interested
in something like the following?
r-spec: [
x: func [] [system/words/x result]
y: func [] [system/words/y result]
z: func [] [system/words/z result]
append: func [str] [system/words/append result str]
]
f: func [/local result] [
; ...
r: make object bind r-spec 'result
; ...
do bind [
x y z
append "stuff"
] in r 'self
; ...
]
Be careful in using r outside of f tough.
G> Also, I have 7 functions, and I would need to do this trick in
G> each one. Is it possible to create some other routine outside
You could create the object r on the fly.
r-spec: clear []
args-of: func [f [any-function!]] [
copy/part f: first :f any [find f refinement! tail f]
]
foreach function [x y z append] [
insert tail r-spec compose/deep [
(to-set-word function) func [(args: next args-of get function)] [
(make path! reduce ['system 'words function]) result (args)
]
]
]
; here you have the same r-spec as above; you can add
; 'result to it (insert tail r-spec [result: system/words/result])
; or use it like in the function f above.
HTH,
Gabriele.
--
Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/