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
]
]
]
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.)
Regards,
Gabriele.
--
Gabriele Santilli <[EMAIL PROTECTED]> --- http://www.rebol.com/
Colella Chiara software division --- http://www.colellachiara.com/
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.