[REBOL] Re: Private/Public attributes
From: joel:neely:fedex at: 15-Nov-2002 16:28
Hi, Ingo,
As I said... where there's a "won't" there's a "will"!
See below!
Ingo Hohmann wrote:
> And as most things, you can find more than one way ...
>
> o: make object! [
> ; public goes here
> self: make object! [
> set: func [val][
> private_val: val
> ]
> get: func [][
> private_val
> ]
> ]
> ; private goes here
> private_val: none
> ]
>
> >> probe o
>
> make object! [
> set: func [val][
> private_val: val
> ]
> get: func [][
> private_val
> ]
> ]
>
> >> o/private_val
> ** Script Error: Invalid path value: private_val
> ** Near: o/private_val
> >> o/self/private_val
> ** Script Error: Invalid path value: private_val
> ** Near: o/self/private_val
> >> o/get
> == none
> >> o/set 3
> == 3
> >> o/get
> == 3
>
Now follow the above transcript with this:
>> set first second get in o 'get 7
== 7
>> o/get
== 7
... to see that "private" really is still meaningless (although
perhaps "obscure" applies! ;-)
-jn-
--
----------------------------------------------------------------------
Joel Neely joelDOTneelyATfedexDOTcom 901-263-4446