Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Words escaping from context! help needed!

From: ammon:johnson::gmail at: 11-Feb-2005 12:08

Gabrielle is right, COMPOSE will do what you want but it gets slightly more complex if it want to really work dynamically... example: make object! [ variables: [a b] data: [1 2] executor: func [program] [ use variables compose/deep [ set [(variables)] data do bind load [(program)] (to lit-word! first variables) ] ] ] example/executor [print a + b] This is a subject (context and binding) I've been meaning to write an article on but there just aren't enough hours in a day... HTH ~~Ammon ;~> On Fri, 11 Feb 2005 18:02:05 +0100, Volker Nitsch <[volker--nitsch--gmail--com]> wrote:
> On Fri, 11 Feb 2005 13:58:14 +0100, Karol Go=C5=BAli=C5=84ski > <[kgozlin--neokartgis--com--pl]> wrote: > > > > > > 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] > > 3 > > >> 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] > > > > 12 > > > > so I can not rely on constatnt variables > > function foreach does similar thing > > but i have no idea how > > > > thanks for reply > > > > Karol > > > > -- > > To unsubscribe from the list, just send an email to rebol-request > > at rebol.com with unsubscribe as the subject. > > > > > > -- > -Volker > > "Any problem in computer science can be solved with another layer of > indirection. But that usually will create another problem." David > Wheeler > -- > To unsubscribe from the list, just send an email to rebol-request > at rebol.com with unsubscribe as the subject. >
-- Enjoy!! ~~~ Ammon ~~~ ~ Sui Generis ~ ~~~~ ;~> ~~~~