[REBOL] Re: Words escaping from context! help needed!
From: volker::nitsch::gmail::com at: 11-Feb-2005 13:07
On Fri, 11 Feb 2005 09:58:20 +0100, Karol Go=C5=BAli=C5=84ski
<[kgozlin--neokartgis--com--pl]> wrote:
>
> Hi list!
> I think I need some "binding" :-)
> this script does not work as I want.
> look :
>
> unset 'a ; just for testing
> unset 'b ;
>
> object: make object! [
> variables: [ a b] ; this block may change during object
> lifetime
;"make object!" detects only set-word in top-level. Rest keeps old ;binding..
;You need
a: b: none
> ; so should be always referenced
> data: [1 2] ; data to set, may change too
>
> ; it has to be that way
> ; below is what i want repair
>
> executor: func [ program] [
> use variables [ ; <-- i want to variables to be defined
> only here -->
> set variables data ; setting variables
> do program ; executing
> ]
> ]
> ]
>
> testing :
>
> >> object/executor [ print a + b]
> 3
> >>
>
> looks fine, but :
>
> >> print [a b]
> 1 2
> >>
>
> ups! variables are in global context
> please help how to keep them in USE block
> thanks in advance
>
> 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