[REBOL] Re: [ A world of words ] naming convention, namespace, namespace pollu
From: greggirwin:mindspring at: 3-Jun-2003 9:56
Hi Marc,
MM> But in ordinary situations (o2, o22, ...), it means that,
MM> AFAIK (????? I hope I am wrong...),
MM> there is no way to create PRIVATE INSTANCE WORDS
I'm not sure of what distinction you want to make between private
*instance* words and private *static* words, as shown in your o3
example. I modded it here to provide a set accessor function.
o3: make object! [
=pri: pri=: none
use [priv3] [
priv3: 3
=pri: does [ priv3 ]
pri=: func [a] [priv3: a]
]
] ;;; priv3 is a PRIVATE STATIC WORD
>> o33: make o3 []
>> o3/=pri
== 3
>> o3/pri=: 33
== 33
>> o3/=pri
== 3
>> o33/=pri
== 3
I would hazard a guess that you can acheive what you want (once we
know exactly what that is).
MM> My own convention is to prefix their name with an "underscore"
MM> and to destroy with energy any script that would contain
MM> a "/" followed by a "_"
MM> Something very easy to detect automatically :-)
I've done the same thing myself in a number of places. Of course, then
I found one place where I wanted to actually use a leading underscore
with words in an object, so I'm still considering what the best
approach or convention is for this kind of thing.
-- Gregg