Index: library/lib/nx-traits.tcl =================================================================== diff -u -racc540eae81024718461724ce69e7971fa9ddfa9 -r6751144a362a62d47801ee1b59caed7aa85f518e --- library/lib/nx-traits.tcl (.../nx-traits.tcl) (revision acc540eae81024718461724ce69e7971fa9ddfa9) +++ library/lib/nx-traits.tcl (.../nx-traits.tcl) (revision 6751144a362a62d47801ee1b59caed7aa85f518e) @@ -113,7 +113,7 @@ # object has the method defined that the trait requires. # nsf::proc checkObject {obj traitName} { - foreach m [$traitName requiredMethods get] { + foreach m [$traitName cget -requiredMethods] { #puts "$m ok? [$obj info methods -closure $m]" if {[$obj info lookup method $m] eq ""} { error "trait $traitName requires $m, which is not defined for $obj" @@ -126,7 +126,7 @@ # class has the method defined that the trait requires. # nsf::proc checkClass {obj traitName} { - foreach m [$traitName requiredMethods get] { + foreach m [$traitName cget -requiredMethods] { #puts "$m ok? [$obj info methods -closure $m]" if {[$obj info methods -closure $m] eq ""} { error "trait $traitName requires $m, which is not defined for $obj" @@ -163,16 +163,19 @@ # nx::Class create nx::Trait -superclass nx::Class { :property {package} - :property -incremental {requiredMethods:0..n ""} - :property -incremental {requiredVariables:0..n ""} + :property {requiredMethods:0..n ""} + :property {requiredVariables:0..n ""} + ::nsf::method::setter [self] requiredMethods:0..n + ::nsf::method::setter [self] requiredVariables:0..n + :public method "require trait" {traitName {nameMap ""}} { # adding a trait to a trait nx::trait::require $traitName nx::trait::add [self] $traitName $nameMap set finalReqMethods {} # remove the methods from the set of required methods, which became available - foreach m [lsort -unique [concat ${:requiredMethods} [$traitName requiredMethods get]]] { + foreach m [lsort -unique [concat ${:requiredMethods} [$traitName cget -requiredMethods]]] { if {[:info methods $m] eq ""} {lappend finalReqMethods $m} } #puts "final reqMethods of [self]: $finalReqMethods // defined=[:info methods]"