I don't understand different behaviour for plain variables and named arrays inherited from base class as visualised by the following example:
itcl::class A {
variable foo
variable FruitBasket
constructor {} {
array set FruitBasket [list Apple 1 Pear 2 Plums 3]
set foo 7
puts "inside constructor of class A, FruitBasket(Pear)=$FruitBasket(Pear)"
}
public method Get {} {
puts foo=$foo
puts FruitBasket(Pear)=$FruitBasket(Pear)
}
}
itcl::class B {
inherit A
constructor {} {
set foo 9
array set FruitBasket [list Apple 2 Pear 4 Plums 6]
puts "inside constructor of class A, FruitBasket(Pear)=$FruitBasket(Pear)"
}
}
If now an object of class B is instantiated, and procedure Get inherited from base class is invoked for the object, while content of the plain variable foo is changed, the named array cannot be even found!
% B1 Get
foo=9
can't read "FruitBasket(Pear)": no such variable
%