Index: doc/example-scripts/bagel.tcl =================================================================== diff -u -r45e24b34c85bf0fc3e14db5250550100bd07ff31 -racc540eae81024718461724ce69e7971fa9ddfa9 --- doc/example-scripts/bagel.tcl (.../bagel.tcl) (revision 45e24b34c85bf0fc3e14db5250550100bd07ff31) +++ doc/example-scripts/bagel.tcl (.../bagel.tcl) (revision acc540eae81024718461724ce69e7971fa9ddfa9) @@ -27,26 +27,24 @@ # they've been toasted. We can create and access an instance variable # by defining an property for the class. All instance variables are # per default public in the sense of C++. -? {Bagel property -accessor public {toasted 0}} "::nsf::classes::Bagel::toasted" +? {Bagel property {toasted 0}} "" # Since abagel was created before the definition of the property we # have to set the default value for it using the setter method. Again, # the info method helps us keep track of things. -? {abagel toasted 0} 0 +? {abagel cget -toasted} 0 ? {abagel info vars} toasted -? {abagel toasted} 0 - # But we really want them to begin in an untoasted state to start # with. ? {Bagel create bagel2} ::bagel2 ? {bagel2 info vars} toasted -? {bagel2 toasted} 0 +? {bagel2 cget -toasted} 0 # # Our bagels now remember whether they've been toasted. Let is @@ -65,15 +63,15 @@ # Tcl procs. Here's the toast method. ? {Bagel public method toast {} { - if {[incr :toasted]>1} then { + if {[incr :toasted] > 1} then { error "something's burning!" } }} "::nsf::classes::Bagel::toast" # The defined methods can be queried with info. We see as well the # setter method for the variable toasted. -? {Bagel info methods} {toasted toast} +? {Bagel info methods} {toast} # Aside from setting the toasted variable, the body of the toast # method demonstrates how to access instance variables by using a @@ -95,7 +93,7 @@ # toppings are empty. ? {nx::Class create SpreadableBagel -superclass Bagel { - :property -accessor public {toppings:0..n ""} + :property -incremental {toppings:0..n ""} }} ::SpreadableBagel ? {SpreadableBagel info superclass} ::Bagel @@ -126,7 +124,7 @@ ? {SpreadableBagel create abagel} ::abagel ? {abagel toast} "" -? {abagel toppings jam} jam +? {abagel toppings add jam} jam ? {abagel taste} "toasty jam" Index: doc/example-scripts/container.tcl =================================================================== diff -u -r45e24b34c85bf0fc3e14db5250550100bd07ff31 -racc540eae81024718461724ce69e7971fa9ddfa9 --- doc/example-scripts/container.tcl (.../container.tcl) (revision 45e24b34c85bf0fc3e14db5250550100bd07ff31) +++ doc/example-scripts/container.tcl (.../container.tcl) (revision acc540eae81024718461724ce69e7971fa9ddfa9) @@ -95,13 +95,13 @@ ? {container2 new} "::container2::member3" # The elements of the container are obtained via the method +items+. -? {container2 items} "::container2::member1 ::container2::member2 ::container2::member3" +? {container2 items get} "::container2::member1 ::container2::member2 ::container2::member3" # When we delete an item in the container ... ? {container2 delete ::container2::member2} "" # the item is as well removed from the +items+ list. -? {container2 items} "::container2::member1 ::container2::member3" +? {container2 items get} "::container2::member1 ::container2::member3" # == Sorted Container # @@ -178,4 +178,4 @@ # The item is as well removed from the result lists ? {container3 items} "::container3::member1 ::container3::member3" -? {container3 index} "::container3::member3 ::container3::member1" \ No newline at end of file +? {container3 index} "::container3::member3 ::container3::member1" Index: doc/example-scripts/traits-composite.tcl =================================================================== diff -u -rac2bbda827dff056beb23cf8400ab77b6996d1e8 -racc540eae81024718461724ce69e7971fa9ddfa9 --- doc/example-scripts/traits-composite.tcl (.../traits-composite.tcl) (revision ac2bbda827dff056beb23cf8400ab77b6996d1e8) +++ doc/example-scripts/traits-composite.tcl (.../traits-composite.tcl) (revision acc540eae81024718461724ce69e7971fa9ddfa9) @@ -19,8 +19,8 @@ # # Define the methods provided by this trait: # - :public method atStart {} {expr {[:position] == [:minPosition]}} - :public method atEnd {} {expr {[:position] == [:maxPosition]}} + :public method atStart {} {expr {[:position get] == [:minPosition]}} + :public method atEnd {} {expr {[:position get] == [:maxPosition]}} :public method setToStart {} {set :position [:minPosition]} :public method setToEnd {} {set :position [:maxPosition]} :public method maxPosition {} {llength ${:collection}} @@ -31,8 +31,8 @@ # from the base class or other traits. The definition is incomplete # in these regards - :requiredMethods position - :requiredVariables collection + :requiredMethods assign position + :requiredVariables assign collection } # @@ -53,7 +53,7 @@ } # This trait requires these methods: - :requiredMethods {setToStart atEnd nextPosition} + :requiredMethods assign {setToStart atEnd nextPosition} # Require the trait "tPositionableStream" :require trait tPositionableStream @@ -75,7 +75,7 @@ } # This trait requires these methods: - :requiredMethods {setToEnd nextPosition} + :requiredMethods assign {setToEnd nextPosition} # Require the trait "tPositionableStream" :require trait tPositionableStream Index: doc/example-scripts/traits-simple.tcl =================================================================== diff -u -rac2bbda827dff056beb23cf8400ab77b6996d1e8 -racc540eae81024718461724ce69e7971fa9ddfa9 --- doc/example-scripts/traits-simple.tcl (.../traits-simple.tcl) (revision ac2bbda827dff056beb23cf8400ab77b6996d1e8) +++ doc/example-scripts/traits-simple.tcl (.../traits-simple.tcl) (revision acc540eae81024718461724ce69e7971fa9ddfa9) @@ -20,8 +20,8 @@ # # Define the methods provided by this trait: # - :public method atStart {} {expr {[:position] == [:minPosition]}} - :public method atEnd {} {expr {[:position] == [:maxPosition]}} + :public method atStart {} {expr {[:position get] == [:minPosition]}} + :public method atEnd {} {expr {[:position get] == [:maxPosition]}} :public method setToStart {} {set :position [:minPosition]} :public method setToEnd {} {set :position [:maxPosition]} :public method maxPosition {} {llength ${:collection}} @@ -40,8 +40,8 @@ # "collection" from the base class. The definition is incomplete in # these regards. - :requiredMethods position - :requiredVariables collection + :requiredMethods assign position + :requiredVariables assign collection } # Define the class +ReadStream+ with properties +position+ and Index: library/lib/nx-traits.tcl =================================================================== diff -u -r9d0ea2cf357adc5108001519286490593977e7e1 -racc540eae81024718461724ce69e7971fa9ddfa9 --- library/lib/nx-traits.tcl (.../nx-traits.tcl) (revision 9d0ea2cf357adc5108001519286490593977e7e1) +++ library/lib/nx-traits.tcl (.../nx-traits.tcl) (revision acc540eae81024718461724ce69e7971fa9ddfa9) @@ -113,7 +113,7 @@ # object has the method defined that the trait requires. # nsf::proc checkObject {obj traitName} { - foreach m [$traitName requiredMethods] { + foreach m [$traitName requiredMethods get] { #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] { + foreach m [$traitName requiredMethods get] { #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" @@ -172,7 +172,7 @@ 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]]] { + foreach m [lsort -unique [concat ${:requiredMethods} [$traitName requiredMethods get]]] { if {[:info methods $m] eq ""} {lappend finalReqMethods $m} } #puts "final reqMethods of [self]: $finalReqMethods // defined=[:info methods]" Index: library/serialize/serializer.tcl =================================================================== diff -u -r74b7a4066526ff5f5a8080ed907f71c9ed5c7700 -racc540eae81024718461724ce69e7971fa9ddfa9 --- library/serialize/serializer.tcl (.../serializer.tcl) (revision 74b7a4066526ff5f5a8080ed907f71c9ed5c7700) +++ library/serialize/serializer.tcl (.../serializer.tcl) (revision acc540eae81024718461724ce69e7971fa9ddfa9) @@ -381,7 +381,7 @@ # don't filter anything during serialization set filterstate [::nsf::configure filter off] set s [:new -childof [::nsf::current object]] - if {[info exists ignoreVarsRE]} {$s ignoreVarsRE $ignoreVarsRE} + if {[info exists ignoreVarsRE]} {$s ignoreVarsRE assign $ignoreVarsRE} if {[info exists ignore]} {$s ignore $ignore} set r [subst { @@ -467,7 +467,7 @@ :public object method deepSerialize {-ignoreVarsRE -ignore -map -objmap args} { :resetPattern set s [:new -childof [::nsf::current object]] - if {[info exists ignoreVarsRE]} {$s ignoreVarsRE $ignoreVarsRE} + if {[info exists ignoreVarsRE]} {$s ignoreVarsRE assign $ignoreVarsRE} if {[info exists ignore]} {$s ignore $ignore} if {[info exists objmap]} {$s objmap $objmap} foreach o $args { Index: library/xotcl/tests/slottest.xotcl =================================================================== diff -u -r4bc60e16c10fdbbb640b3019d4bdebdc469fdf55 -racc540eae81024718461724ce69e7971fa9ddfa9 --- library/xotcl/tests/slottest.xotcl (.../slottest.xotcl) (revision 4bc60e16c10fdbbb640b3019d4bdebdc469fdf55) +++ library/xotcl/tests/slottest.xotcl (.../slottest.xotcl) (revision acc540eae81024718461724ce69e7971fa9ddfa9) @@ -619,9 +619,9 @@ ? {lsort [Person info slots]} "::Person::slot::name ::Person::slot::projects ::Person::slot::salary" -? {Person::slot::name multivalued} 0 -? {Person::slot::salary multivalued} 0 -? {Person::slot::projects multivalued} 1 +? {Person::slot::name multivalued get} 0 +? {Person::slot::salary multivalued get} 0 +? {Person::slot::projects multivalued get} 1 Person p2 -name "John Doe" ? {p2 name} "John Doe" Index: tests/protected.test =================================================================== diff -u -r4bc60e16c10fdbbb640b3019d4bdebdc469fdf55 -racc540eae81024718461724ce69e7971fa9ddfa9 --- tests/protected.test (.../protected.test) (revision 4bc60e16c10fdbbb640b3019d4bdebdc469fdf55) +++ tests/protected.test (.../protected.test) (revision acc540eae81024718461724ce69e7971fa9ddfa9) @@ -693,17 +693,17 @@ :property -accessor protected {b b1} :property -accessor private {c c1} :property -accessor private {d:integer 1} - :public method foo {p} {return [: $p]} - :public method bar {p} {return [: -local $p]} - :public method baz {p v} {return [: -local $p $v]} + :public method foo {p} {return [: $p get]} + :public method bar {p} {return [: -local $p get]} + :public method baz {p v} {return [: -local $p assign $v]} :create c1 } # call properties directly - ? {c1 a} a1 - ? {c1 b} {::c1: unable to dispatch method 'b'} - ? {c1 c} {::c1: unable to dispatch method 'c'} + ? {c1 a get} a1 + ? {c1 b get} {::c1: unable to dispatch method 'b'} + ? {c1 c get} {::c1: unable to dispatch method 'c'} # call properties via method @@ -736,15 +736,15 @@ # nx::Class create D -superclass C { :property -accessor private {c c1d} - :public method bard {p} {return [: -local $p]} + :public method bard {p} {return [: -local $p get]} :create d1 { :object property -accessor public {c c1o} } } ? {d1 bar c} c1 ? {d1 bard c} c1d - ? {d1 c} c1o + ? {d1 c get} c1o # # Define a public property with the same name as the private @@ -755,17 +755,17 @@ # nx::Class create D -superclass C { :property -accessor public {c c1d} - :public method bard {p} {return [: -local $p]} + :public method bard {p} {return [: -local $p get]} :create d1 { :object property -accessor private {c c1o} - :public object method bard1 {p} {return [: -local $p]} + :public object method bard1 {p} {return [: -local $p get]} } } ? {d1 bar c} c1 ? {d1 bard c} c1d ? {d1 bard1 c} c1o - ? {d1 c} c1d + ? {d1 c get} c1d } # @@ -778,15 +778,15 @@ } nx::Class create D -superclass C { :property -accessor private {x d} - :public method bar-d {p} {return [: -local $p]} + :public method bar-d {p} {return [: -local $p get]} } nx::Class create E -superclass D { :property -accessor private {x e} - :public method bar-e {p} {return [: -local $p]} + :public method bar-e {p} {return [: -local $p get]} } E create e1 - ? {e1 x} c + ? {e1 x get} c ? {e1 bar-d x} d ? {e1 bar-e x} e } @@ -800,14 +800,14 @@ :object property -accessor protected {b b1} :object property -accessor private {c c1} :object property -accessor private {d:integer 1} - :public object method foo {p} {return [: $p]} - :public object method bar {p} {return [: -local $p]} - :public object method baz {p v} {return [: -local $p $v]} + :public object method foo {p} {return [: $p get]} + :public object method bar {p} {return [: -local $p get]} + :public object method baz {p v} {return [: -local $p assign $v]} } - ? {o a} a1 - ? {o b} {::o: unable to dispatch method 'b'} - ? {o c} {::o: unable to dispatch method 'c'} + ? {o a get} a1 + ? {o b get} {::o: unable to dispatch method 'b'} + ? {o c get} {::o: unable to dispatch method 'c'} ? {o foo a} a1 ? {o foo b} b1 @@ -836,18 +836,18 @@ :object property -accessor protected {b b1} :object property -accessor private {c c1} :object property -accessor private {d:integer 1} - :public object method foo {p} {return [: $p]} - :public object method bar {p} {return [: -local $p]} - :public object method baz {p v} {return [: -local $p $v]} + :public object method foo {p} {return [: $p get]} + :public object method bar {p} {return [: -local $p get]} + :public object method baz {p v} {return [: -local $p assign $v]} } - ? {C a} a1 - ? {C b} {method 'b' unknown for ::C; consider '::C create b ' instead of '::C b '} - ? {C c} {method 'c' unknown for ::C; consider '::C create c ' instead of '::C c '} + ? {C a get} a1 + ? {C b get} {method 'b' unknown for ::C; consider '::C create b get' instead of '::C b get'} + ? {C c get} {method 'c' unknown for ::C; consider '::C create c get' instead of '::C c get'} ? {C foo a} a1 ? {C foo b} b1 - ? {C foo c} {method 'c' unknown for ::C; consider '::C create c ' instead of '::C c '} + ? {C foo c} {method 'c' unknown for ::C; consider '::C create c get' instead of '::C c get'} ? {C bar a} a1 ? {C bar b} b1 Index: tests/serialize.test =================================================================== diff -u -r4bc60e16c10fdbbb640b3019d4bdebdc469fdf55 -racc540eae81024718461724ce69e7971fa9ddfa9 --- tests/serialize.test (.../serialize.test) (revision 4bc60e16c10fdbbb640b3019d4bdebdc469fdf55) +++ tests/serialize.test (.../serialize.test) (revision acc540eae81024718461724ce69e7971fa9ddfa9) @@ -8,14 +8,14 @@ Object create ::a { :object property -accessor public ref:object,type=[:info class] Object create [self]::b { - [:info parent] ref [Object create [self]::c] + [:info parent] ref assign [Object create [self]::c] } } ? {::nsf::object::exists ::a} 1 ? {::nsf::object::exists ::a::b} 1 ? {::nsf::object::exists ::a::b::c} 1 - ? {::a ref} [[::a::b] info children] + ? {::a ref get} [[::a::b] info children] set script [::Serializer deepSerialize -map {::a::b ::x::y ::a ::x} ::a] # fix collateral damage (TODO: fixme, preprecate me, ...) @@ -36,7 +36,7 @@ ? {::nsf::object::exists ::x} 1 ? {::nsf::object::exists ::x::y} 1 ? {::nsf::object::exists ::x::y::c} 1 - ? {::x ref} [::x::y info children] + ? {::x ref get} [::x::y info children] Object create ::a ::x::y::c eval { @@ -62,28 +62,27 @@ :create c1 } - ? {C x 1} 1 - ? {C x} 1 - ? {C y 1} 1 - ? {C y} 1 + ? {C x assign 1} 1 + ? {C x get} 1 + ? {C y assign 1} 1 + ? {C y get} 1 ? {lsort [C info methods]} "a b" ? {lsort [C info object methods]} "x y" - ? {c1 a b} {expected integer but got "b" for parameter "a"} - ? {c1 a 1} 1 - ? {c1 b 1} 1 + ? {c1 a assign b} {expected integer but got "b" for parameter "value"} + ? {c1 a assign 1} 1 + ? {c1 b assign 1} 1 set c1(IgnoreNone1) [list [::Serializer deepSerialize c1] "a b"] set c1(IgnoreNone2) [list [::Serializer deepSerialize -ignoreVarsRE "" c1] "a b"] - set c1(One) [list [::Serializer deepSerialize -ignoreVarsRE "a" c1] "b"] - set c1(One2) [list [::Serializer deepSerialize -ignoreVarsRE {::a$} c1] "b"] - set c1(IgnoreAll) [list [::Serializer deepSerialize -ignoreVarsRE "." c1] ""] + set c1(One) [list [::Serializer deepSerialize -ignoreVarsRE "a" c1] "b"] + set c1(One2) [list [::Serializer deepSerialize -ignoreVarsRE {::a$} c1] "b"] + set c1(IgnoreAll) [list [::Serializer deepSerialize -ignoreVarsRE "." c1] ""] set names {}; foreach s [C info slots] {lappend names [$s name]} - set c1(None2) [list [::Serializer deepSerialize -ignoreVarsRE \ - [join $names |] c1] ""] + set c1(None2) [list [::Serializer deepSerialize -ignoreVarsRE [join $names |] c1] ""] c1 destroy - +puts stderr ====1 foreach t [array names c1] { ? {nsf::object::exists c1} 0 lassign $c1($t) script res Index: tests/traits.test =================================================================== diff -u -r9d0ea2cf357adc5108001519286490593977e7e1 -racc540eae81024718461724ce69e7971fa9ddfa9 --- tests/traits.test (.../traits.test) (revision 9d0ea2cf357adc5108001519286490593977e7e1) +++ tests/traits.test (.../traits.test) (revision acc540eae81024718461724ce69e7971fa9ddfa9) @@ -8,15 +8,15 @@ :public method t1m2 {} {return t1.[current method]} # This trait requires a method "foo" - :requiredMethods foo + :requiredMethods add foo } nx::Trait create t2 { :public method "bar x" {} {return t2.[current methodpath]} :public method "bar y" {} {return t2.[current methodpath]} :public method foo {} {return t2.[current methodpath]} # This trait requires a method "t1m1" - :requiredMethods t1m1 + :requiredMethods add t1m1 } nx::Trait create t3 {