From: Michael B. <M....@de...> - 2002-11-21 08:44:00
|
M Backe wrote: > > Itcl does not support dynamic classes, i.e., you can't redefine class > elements after construction. > > Marty > > > Hi all > > > > I want to create public variables inside a method and be able to > > configure it with configure -myVariable > > > > The point is: the program will not know the variables names until it is > > already running, thus I can't predefine the variables in the data member > > section as usual. > > > > Any tips? > > > > Thanks in advanced, > > > > Pedro Kroger This behaviour isn't possible but you can simulate it. Use a private array variable in your method. If you want to create an new "variable" then add an element to that array. Second, define your own configure method. ex: class A { private variable _myvars method myconfigure {varname {value {}}} { if {[string equal {} $value]} then { return $_myvars($varname) } else { set _myvars($varname) $value } } } Michael |