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
<[EMAIL PROTECTED]> wrote:
> 
> On Fri, 11 Feb 2005 13:58:14 +0100, Karol Go=C5=BAli=C5=84ski
> <[EMAIL PROTECTED]> wrote:
> >=20
> >=20
> > I set them to none, but it does not help, see
> >=20
> > 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:".
> 
> >=20
> > >>
> > >> object/executor [ print a + b]
> > 3
> > >> print [a b]
> > 1 2
> > >>
> > still 'a and 'b are in global context
> >=20
> > but I want also do such things :
> >=20
> > object/valiables: [ x y]
> > object/data: [3 4]
> > object/executor [ print x * y]
> >=20
> > 12
> >=20
> > so I can not rely on constatnt variables
> > function foreach does similar thing
> > but i have no idea how
> >=20
> > thanks for reply
> >=20
> > Karol
> >=20
> > --
> > To unsubscribe from the list, just send an email to rebol-request
> > at rebol.com with unsubscribe as the subject.
> >=20
> >=20
> 
> --=20
> -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 ~
~~~~  ;~>  ~~~~
-- 
To unsubscribe from the list, just send an email to rebol-request
at rebol.com with unsubscribe as the subject.

Reply via email to