Index: doc/example-scripts/traits-composite.tcl =================================================================== diff -u -rd31c271afb2488abafa0642b07538a3e62106130 -rf858f142f5fab4f88996b3eb709c3afa55114be9 --- doc/example-scripts/traits-composite.tcl (.../traits-composite.tcl) (revision d31c271afb2488abafa0642b07538a3e62106130) +++ doc/example-scripts/traits-composite.tcl (.../traits-composite.tcl) (revision f858f142f5fab4f88996b3eb709c3afa55114be9) @@ -19,13 +19,13 @@ # # Define the methods provided by this trait: # - :public method atStart {} {expr {[:position] == [:minPosition]}} - :public method atEnd {} {expr {[:position] == [:maxPosition]}} - :public method setToStart {} {set :position [:minPosition]} - :public method setToEnd {} {set :position [:maxPosition]} - :public method maxPosition {} {llength ${:collection}} - :public method minPosition {} {return 0} - :public method nextPosition {} {incr :position 1} + :public object method atStart {} {expr {[:position] == [:minPosition]}} + :public object method atEnd {} {expr {[:position] == [:maxPosition]}} + :public object method setToStart {} {set :position [:minPosition]} + :public object method setToEnd {} {set :position [:maxPosition]} + :public object method maxPosition {} {llength ${:collection}} + :public object method minPosition {} {return 0} + :public object method nextPosition {} {incr :position 1} # The trait requires a method "position" and a variable "collection" # from the base class or other traits. The definition is incomplete @@ -43,8 +43,8 @@ # # Methods provided by this trait: # - :public method on {collection} {set :collection $collection; :setToStart} - :public method next {} { + :public object method on {collection} {set :collection $collection; :setToStart} + :public object method next {} { if {[:atEnd]} {return ""} else { set r [lindex ${:collection} ${:position}] :nextPosition @@ -67,8 +67,8 @@ # # Methods provided by this trait: # - :public method on {collection} {set :collection $collection; :setToEnd} - :public method nextPut {element} { + :public object method on {collection} {set :collection $collection; :setToEnd} + :public object method nextPut {element} { lappend :collection $element :nextPosition return ""