[Xotcl] Dynamic class change question

Gustaf Neumann neumann at wu-wien.ac.at
Wed Mar 1 10:48:04 CET 2006


Murr, Florian schrieb:
> In XOTcl (1.3.8) there seems to be no initialisation of parameters
> during dynamic class change.
>   
this is intended behavior.  when an object changes its class, it is not 
clear
that someone want's to re-initialize variables, etc.. btw, there is a 
similar situation,
when mixining-in classes with parameter definitions.
> See code below: a1 and a2 behave differently.
>   
they don't behave differently on themselves, you are doing different 
things there.
certainly, when you call a method setting an instvar, it is afterwards 
there,
if you don't call it, its not there.

I think, you question is: how can i get the default values from parameters
set, when i change dynamically the class. The following definition
helps you with that:

=============================
Object instmixin add \
    [Class new -instproc class args {next; ::xotcl::Class::Parameter 
searchDefaults [self]}]
=============================

btw, you can get rid of the string-map-INFO business by using

   ...
   package require xotcl::trace
   ...
   A instproc pp {} { my showVars }
   ...

hope this helps
-gustaf neumann



More information about the Xotcl mailing list