[Xotcl] Initialisation arguments

Kristoffer Lawson setok at fishpool.com
Sat Oct 21 11:02:55 CEST 2006


On 21 Oct 2006, at 11:33, Gustaf Neumann wrote:

> Kristoffer Lawson schrieb:
>>
>> I don't mean the state of the object at time of calling, in the  
>> sense of slots, but the values passed to the constructor on object  
>> creation. The args to 'init'. The reason for this is that it might  
>> not be enough to just create the object with the appropriate  
>> state, but it might need to go through the 'init' stage as well,  
>> so the proper initialisation chain is done (f.ex. might be calls  
>> to other things taking place there, registration with managers  
>> etc). After that, slots can be set.
> i see, you mean the per-object parameterization; the arguments to  
> the object/class creation are not stored explicitely
> in XOTcl. However, the simplest way to save these is to provide a  
> per-class mixin for overloading the standard
> configure behavior.
>
> Does this help?

No, I didn't mean per-object parametrisation, but the arguments  
passed to the constructor itself. F.ex.

Class Foo

Foo instproc init {name parent} {
   ....
}

And then I could ask of any 'Foo' object about what 'name' and  
'parent' were used to create it, without the object itself having to  
know about this logic.

Mixins are probably risky here as the 'init' method does not have to  
call [next]. I could do this with a filter, I guess, or perhaps by  
overloading [create]. I just wondered if I had overlooked something  
and this information might be available somehow and that if this  
information was stored internally, it could be exported to the script  
level, but I gather that it is not?

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



More information about the Xotcl mailing list