[REBOL] Re: object funnies
From: allenk:powerup:au at: 19-Oct-2001 11:20
----- Original Message -----
From: "Graham Chiu" <[gchiu--compkarori--co--nz]>
To: <[rebol-list--rebol--com]>
Sent: Friday, October 19, 2001 10:57 AM
Subject: [REBOL] Re: object funnies
> Still trying to puzzle this one out ....
>
> test: make object! [
> test1: 1
>
> fun: does [
> test2: 2
> test3: 3
> test1: test2 + test3
> ]
> ]
>
> Reading the core docs, I sort of expected that the instance
> variables test1, test2 and test3 are encapsulated within the
> object test.
>
> But it seems that test2 and test3 are available in the
> global context, but test1 is not.
>
Yep, that is correct. If you want them local to the object include them in
its context.
test: make object! [
test1: 1
test2: test3: none
fun: does [
test2: 2
test3: 3
test1: test2 + test3
]
]
Cheers,
Allen K