Private methods (was [Xotcl] build problem on solaris)

Kristoffer Lawson setok at fishpool.com
Wed Jul 28 12:31:42 CEST 2004


On Tue, 27 Jul 2004, Schofield, Bryan \(GE Transportation\) wrote:

> Here is a quick hack example showing how to privatize a method. The
> instproc "priv" simply registers a method name to be considered private.
> Then a filter checks to see if the a method being called from somewhere
> outside of the object has been registered; If so, it throws. There is a
> lot of refinement that could be done, but at least this shows how a
> filter could be used to provide levels of protection. Making variables
> private is a little trickier. That might require the overloading
> variable mutators like "set", "lappend", "append" & so on. But one could
> make all thoses method private and then you've essentially made all
> variable private. Then use "parameters" for publicly accessible data,
> which is probably better any way since you are not allowing outsiders to
> directly change a variable, but rather providing them an interface to
> get & set the value of some piece of data.

Would it be nice if there was something akin to filters, but for
variables? A bit like Tcl variable traces, but better (as they only get
triggered once the change has already been made :P).

                              / http://www.fishpool.com/~setok/



More information about the Xotcl mailing list