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

Re: [Xotcl] Dynamic class change question

From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Wed, 01 Mar 2006 10:48:04 +0100

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