[REBOL] Re: Words escaping from context! help needed!
From: volker::nitsch::gmail::com at: 11-Feb-2005 18:02
On Fri, 11 Feb 2005 13:58:14 +0100, Karol Go=C5=BAli=C5=84ski
> I set them to none, but it does not help, see
> unset 'a
> unset 'b
> object: make object! [
> variables: [ a b]
> data: [1 2]
> executor: func [ program] [
> use variables [
> a: b: none
> set variables data
> do program
when i wrote: "make object!" detects only set-word in top-level"
i meant the top-level block. "make object!" does not look inside inner
blocks. so this:
make object![ inner-block: [ a: b: none ] ]
would not work. and you do similar with executor. but this:
make object![ a: b: none ]
works. "make object!" sees the set-words and makes them local for
everything inside the block. so the 'a 'executor will be bound to the
object and no longer be global.
its also not required to set them to none, only that they appear as
set-words in the top-level block. so 'executor is local too, because
the appears "executor:".
> >> object/executor [ print a + b]
> >> print [a b]
> 1 2
> still 'a and 'b are in global context
> but I want also do such things :
> object/valiables: [ x y]
> object/data: [3 4]
> object/executor [ print x * y]
> so I can not rely on constatnt variables
> function foreach does similar thing
> but i have no idea how
> thanks for reply
> To unsubscribe from the list, just send an email to rebol-request
> at rebol.com with unsubscribe as the subject.
Any problem in computer science can be solved with another layer of
indirection. But that usually will create another problem.