[REBOL] Trying to compose a block out of global and local bindings Re:
From: ssayer:acuson at: 7-Sep-2000 18:02
I'll point out quickly that what you're trying to do is generally
considered a bad programming practice, i.e. referencing a variable
internal to a function from its argument. A caller shouldn't need to know
about and shouldn't really have direct access to variables local to a
function.
I will however provide an example of how to do what I think you're trying
to do and recommend that you rethink your approach in any case because
this is almost as bad but I think it demonstrates that your problem was
perhaps not one as much of scope but more of tokenization:
>> letter2: func [b][foreach n ["sally" "sue"][print replace (copy b) 'name n]]
>> greeting: ["hi" name "welcome back"]
== ["hi" name "welcome back"]
>> {I prefer not to overwrite REBOL words, like "form" from your example}
== {I prefer not to overwrite REBOL words, like "form" from your example}
>> name: "bob"
== "bob"
>> letter2 greeting
hi sally welcome back
hi sue welcome back
>>
FWIW,
<SS>
On Thu, 7 Sep 2000 [princepawn--lycos--com] wrote: