[Sarnold] thinks that classes should look - as possible as they can - like [namespace]s, because it is the current encapsulation model. It may be extreme, but some developers may want to convert quickly a namespace in a Class or Megawidget - while the opposite cannot be as simple. I would like to see: namespace class foo { common counter variable names proc __init__ {args} { common counter incr counter variable names array set names $args } # it has to look like a normal Tcl proc, so it has an arglist proc __destroy__ {} { common counter incr counter -1 } proc display {} { variable names puts "My name is $names(first) $names(last)" } proc count {} { common counter return $counter } } foo new name first Richard last Heinz name destroy set name [foo %AUTO% first Richard last Heinz] $name display set name::names(first) George $name display # generates an error, because it is an instance method #foo display $name destroy Where ''common'' would behave like ''variable'', with a ''static'' qualifier. I submit that a sequence of ''variable bar'' may be replaced by ''instance'' command that wraps all ''variable'' calls related to (instance) variables. namespace class foo { variable a variable name variable tool variable logfile proc __init__ ... proc __destroy__ ... proc __classinit__ ... proc __classdestroy__ ... proc display {{intologfile no}} { instance ; # no need to invoke 'variable' again if {$intologfile} { puts $logfile "a=$a name=$name tool=$tool" } else { puts "a=$a name=$name tool=$tool" } } ... } And a proc is a class method, until it invokes ''variable'' or ''instance'' commands, or uses an instance namespace qualifier. During instanciation, all namespace qualifiers equal to ::foo should be replaced by the ''instance'''s namespace qualifier, so that we can still use ''-textvariable'' Tk option. namespace class foo { variable label proc __init__ {w} { label $w.lbl -textvariable ::foo::label pack $w.lbl } ... } The class name may instantiate objects by two methods: foo new foo %AUTO% Any proc (without use of instance variables) could be called this way : foo The special procs, __init__ __destroy__ __classinit__ __classdestroy__ should throw an error when they are explicitly called. There are shortcuts to achieve direct variable setting : instead of set a [foo %AUTO% Lennon] set ${a}::name John puts [set ${a}::name] you just can do set [a . name] John puts [a -> name] Then, commons are accessed ''out of the class definition'' by set foo::counter 0 for a class named foo. Remember that the common namespace is mapped (by [string map]) into the instance's namespace at instanciation. Below is an attempt to achieve this goal - keep namespaces simple and just add a replication mechanism. ---- ''New features'' (2006-04-24) component varname ?-common boolean ?-initscript script? ?-destroyscript script?? declares a common/instance variable that acts like a subcommand. alias ?arg ...? is like [interp alias], but with basique objects. body