Index: library/lib/nx-traits.tcl =================================================================== diff -u -r444fa56b72c6d35bd3cbbe46a44b12a4ea33088f -r2076ef459f42cdf6426522aab56be490b66c2436 --- library/lib/nx-traits.tcl (.../nx-traits.tcl) (revision 444fa56b72c6d35bd3cbbe46a44b12a4ea33088f) +++ library/lib/nx-traits.tcl (.../nx-traits.tcl) (revision 2076ef459f42cdf6426522aab56be490b66c2436) @@ -40,23 +40,20 @@ nsf::proc nx::addTrait {obj traitName {nameMap ""}} { array set map $nameMap - foreach m [$traitName info methods] { + foreach m [$traitName info methods -callprotection all] { if {[info exists map($m)]} {set newName $map($m)} else {set newName $m} $obj public alias $newName [$traitName info method handle $m] } } nx::Class public method useTrait {traitName {nameMap ""}} { # adding a trait to a class - set obj [:new] foreach m [$traitName requiredMethods] { - # it would be nice to have a ":info methods -closure $m", we would not have to instantiate the class. #puts "$m ok? [:info methods -closure $m]" - if {[$obj info lookup method $m] eq ""} { + if {[:info methods -closure $m] eq ""} { error "trait $traitName requires $m, which is not defined" } } - $obj destroy nx::addTrait [self] $traitName $nameMap }