View · Search · Index
No registered users in community xowiki
in last 10 minutes

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

From: Kristoffer Lawson <setok_at_fishpool.com>
Date: Wed, 28 Jul 2004 13:31:42 +0300 (EEST)

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/