package require snit snit::type Dict { variable dictv method append {key args} { variable dictv return [eval ::dict append dictv [list $key] $args] } method exists {args} { variable dictv return [eval ::dict exists [list $dictv] $args] } method filter {ftype args} { variable dictv return [eval ::dict [list $dictv $ftype] $args] } method for {kv body} { variable dictv return [uplevel 1 ::dict for $kv $dictv $body] } method get {args} { variable dictv return [eval ::dict get [list $dictv] $args] } method incr {key {incr 1}} { variable dictv return [::dict incr dictv $key $incr] } method keys {{glob *}} { variable dictv return [eval ::dict keys [list $dictv] $glob] } method lappend {key args} { variable dictv return [eval ::dict lappend dictv [list $key] $args] } method remove {args} { variable dictv return [::set dictv [eval ::dict remove [list $dictv] $args]] } method replace {args} { variable dictv return [::set dictv [eval ::dict replace [list $dictv] $args]] } method set {args} { variable dictv return [::set dictv [eval ::dict set dictv $args]] } method size {} { variable dictv return [::dict size $dictv] } method unset {args} { variable dictv return [eval ::dict unset dictv $args] } method values {{glob *}} { variable dictv return [::dict values $dictv $glob] } method subdict {sub args} { variable dictv return [$self set [eval ::dict create $args]] } method serialize {} { variable dictv return $dictv } method restore {ser} { variable dictv eval dict set dictv $ser } constructor {args} { variable dictv ::set dictv [eval ::dict create $args] } destructor {} } ---- [WHD]: Two questions: why are you declaring dictv in every method? You don't need to. Second, why are you explicitly qualifying "::set"? You don't need to do that either. [CMcC]: Answer 1) I think I should have to. It's been a while since I looked at snit's implementation, but how is the silent importation of instance variables achieved? Instance vars exist in namespaces, AFAIK they have to be qualified by namespace or explicitly declared. If Snit's doing the variable declaration itself, then there's an avoidable overhead.