* Gabriele Santilli <[EMAIL PROTECTED]> [060706 01:14]:
> 
> Hi Gregg,
> 
> On Wednesday, July 5, 2006, 6:16:09 PM, you wrote:
> 
> GI> You *can* do it today, but it takes extra effort. I thought I would do
> GI> it a lot, once I figured out how (with the help of people here), but
> GI> I've never used it in a production system.
> 
> The  way  Gregg is mentioning is just using a "hidden" context for
> your "protected" words.
> 
> Example:
> 
>    use [private-field] [
>        private-field: 2
>        my-obj: context [
>            public-field: 1
>            set-field: func [val] [
>                private-field: val
>            ]
>            get-field: does [
>                private-field
>            ]
>        ]
>    ]
 
  This is very 'use'ful to know!

  FYI: this is like the lisp use of 'let
  in the "upper level"
  
  Greg should put it in the cookbook..

> The  disadvantage  is that you can't easily clone the object (that
> wouldn't  clone  the other context, so that would be shared by all
> clones),  so  you need a constructor function. However there is no
> way  for  you to change PRIVATE-FIELD by mistake. 

> (Note that there are  many  ways  to  achieve  this result, so it
> really depends on what's best in your specific case.)

  It would be interesting to see other examples.
  cheers
  tim

-- 
Tim Johnson <[EMAIL PROTECTED]>
      http://www.alaska-internet-solutions.com
-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to