[REBOL] Re: [Refinements] Passing Refinements
From: gabriele::colellachiara::com at: 6-Feb-2005 13:38
Hi Peter,
On Sunday, February 6, 2005, 12:02:22 PM, you wrote:
P> Thanks for the advice. I'll start looking into sharing contexts. What I'm
P> doing is very simple, it's basically
P> A: func [/refa /refb] [
P> either refa
P> [b/refa]
P> [either refb
P> [b/refb]
P> [b]
P> ]
P> ]
Special case: if B is only going to be called from A, you just do:
a: func [/refa /refb] [
[refa]
b
]
b: does bind [
print [refa refb]
] first first second :a
>> a
none none
>> a/refa
true none
>> a/refb
none true
This way you are basically making B a "slave function" of A. It's
a case that happens relatively often, and using this solution
makes it very efficient too.
If B was a normal function that you wanted to call otherwise too,
you could just do something like:
b: func [/refa /refb] [
print [refa refb]
]
a: func [/refa /refb] [
[refa]
b'
]
b': does bind second :b first first second :a
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/