Index: TODO =================================================================== diff -u -r8b8e75e010beae46adb99f4902ca80c50b1a6825 -r6ad7855cd7aba089f7a160293802e1639d0d6198 --- TODO (.../TODO) (revision 8b8e75e010beae46adb99f4902ca80c50b1a6825) +++ TODO (.../TODO) (revision 6ad7855cd7aba089f7a160293802e1639d0d6198) @@ -3659,6 +3659,7 @@ - example scripts: added tk-mini and tk-horse-race - make "/object/ require" an ensemble method +- traits: renamed "useTrait" into "require trait" TODO: Index: doc/example-scripts/tk-horse-race.html =================================================================== diff -u -r2076ef459f42cdf6426522aab56be490b66c2436 -r6ad7855cd7aba089f7a160293802e1639d0d6198 --- doc/example-scripts/tk-horse-race.html (.../tk-horse-race.html) (revision 2076ef459f42cdf6426522aab56be490b66c2436) +++ doc/example-scripts/tk-horse-race.html (.../tk-horse-race.html) (revision 6ad7855cd7aba089f7a160293802e1639d0d6198) @@ -773,8 +773,8 @@ :property canvas:required ;# the canvas, on which the horse is drawn :property n:integer,required ;# the position on the canvas - :useTrait nx::TCallback - :useTrait TListUtils + :require trait nx::TCallback + :require trait TListUtils :method draw {x y} { set hide [:lpick {black brown white gray brown3 brown4}] @@ -812,8 +812,8 @@ :property {height 330} ;# height of the canvas :property {horses} ;# a list of horse names participating in the game - :useTrait nx::TCallback - :useTrait TListUtils + :require trait nx::TCallback + :require trait TListUtils :method init {} { # @@ -889,7 +889,7 @@

Index: doc/example-scripts/tk-horse-race.tcl =================================================================== diff -u -r2076ef459f42cdf6426522aab56be490b66c2436 -r6ad7855cd7aba089f7a160293802e1639d0d6198 --- doc/example-scripts/tk-horse-race.tcl (.../tk-horse-race.tcl) (revision 2076ef459f42cdf6426522aab56be490b66c2436) +++ doc/example-scripts/tk-horse-race.tcl (.../tk-horse-race.tcl) (revision 6ad7855cd7aba089f7a160293802e1639d0d6198) @@ -41,8 +41,8 @@ :property canvas:required ;# the canvas, on which the horse is drawn :property n:integer,required ;# the position on the canvas - :useTrait nx::TCallback - :useTrait TListUtils + :require trait nx::TCallback + :require trait TListUtils :method draw {x y} { set hide [:lpick {black brown white gray brown3 brown4}] @@ -80,8 +80,8 @@ :property {height 330} ;# height of the canvas :property {horses} ;# a list of horse names participating in the game - :useTrait nx::TCallback - :useTrait TListUtils + :require trait nx::TCallback + :require trait TListUtils :method init {} { # Index: doc/example-scripts/tk-mini.html =================================================================== diff -u -r2076ef459f42cdf6426522aab56be490b66c2436 -r6ad7855cd7aba089f7a160293802e1639d0d6198 --- doc/example-scripts/tk-mini.html (.../tk-mini.html) (revision 2076ef459f42cdf6426522aab56be490b66c2436) +++ doc/example-scripts/tk-mini.html (.../tk-mini.html) (revision 6ad7855cd7aba089f7a160293802e1639d0d6198) @@ -746,7 +746,7 @@ # # The trait TCallback imports methods "callback" and "bindvar" # - :useTrait nx::TCallback +
:require trait nx::TCallback :public method button-pressed {} { # When this method is invoked, the content of the ".label" widget @@ -771,7 +771,7 @@

Index: doc/example-scripts/tk-mini.tcl =================================================================== diff -u -r2076ef459f42cdf6426522aab56be490b66c2436 -r6ad7855cd7aba089f7a160293802e1639d0d6198 --- doc/example-scripts/tk-mini.tcl (.../tk-mini.tcl) (revision 2076ef459f42cdf6426522aab56be490b66c2436) +++ doc/example-scripts/tk-mini.tcl (.../tk-mini.tcl) (revision 6ad7855cd7aba089f7a160293802e1639d0d6198) @@ -16,7 +16,7 @@ # # The trait TCallback imports methods "callback" and "bindvar" # - :useTrait nx::TCallback + :require trait nx::TCallback :public method button-pressed {} { # When this method is invoked, the content of the ".label" widget Index: doc/example-scripts/traits-composite.html =================================================================== diff -u -r444fa56b72c6d35bd3cbbe46a44b12a4ea33088f -r6ad7855cd7aba089f7a160293802e1639d0d6198 --- doc/example-scripts/traits-composite.html (.../traits-composite.html) (revision 444fa56b72c6d35bd3cbbe46a44b12a4ea33088f) +++ doc/example-scripts/traits-composite.html (.../traits-composite.html) (revision 6ad7855cd7aba089f7a160293802e1639d0d6198) @@ -802,8 +802,8 @@ # This trait requires these methods: :requiredMethods {setToStart atEnd nextPosition} - # Use the trait "TPositionableStream" - :useTrait TPositionableStream + # Require the trait "TPositionableStream" + :require trait TPositionableStream }

Create a composite trait called TWriteStream based on the trait TPositionableStream:

@@ -832,8 +832,8 @@ # This trait requires these methods: :requiredMethods {setToEnd nextPosition} - # Use the trait "TPositionableStream" - :useTrait TPositionableStream + # Require the trait "TPositionableStream" + :require trait TPositionableStream }

Define a class ReadStream with properties position and collection that uses the composite trait TReadStream:

@@ -851,7 +851,7 @@
nx::Class create ReadStream {
   :property {collection ""}
   :property {position 0}
-  :useTrait TReadStream
+  :require trait TReadStream
 }

Create an instance of ReadStream:

@@ -892,7 +892,7 @@

Index: doc/example-scripts/traits-composite.tcl =================================================================== diff -u -r444fa56b72c6d35bd3cbbe46a44b12a4ea33088f -r6ad7855cd7aba089f7a160293802e1639d0d6198 --- doc/example-scripts/traits-composite.tcl (.../traits-composite.tcl) (revision 444fa56b72c6d35bd3cbbe46a44b12a4ea33088f) +++ doc/example-scripts/traits-composite.tcl (.../traits-composite.tcl) (revision 6ad7855cd7aba089f7a160293802e1639d0d6198) @@ -55,8 +55,8 @@ # This trait requires these methods: :requiredMethods {setToStart atEnd nextPosition} - # Use the trait "TPositionableStream" - :useTrait TPositionableStream + # Require the trait "TPositionableStream" + :require trait TPositionableStream } # @@ -77,16 +77,16 @@ # This trait requires these methods: :requiredMethods {setToEnd nextPosition} - # Use the trait "TPositionableStream" - :useTrait TPositionableStream + # Require the trait "TPositionableStream" + :require trait TPositionableStream } # Define a class +ReadStream+ with properties +position+ and # +collection+ that uses the composite trait +TReadStream+: nx::Class create ReadStream { :property {collection ""} :property {position 0} - :useTrait TReadStream + :require trait TReadStream } # Create an instance of +ReadStream+: Index: doc/example-scripts/traits-simple.html =================================================================== diff -u -r2076ef459f42cdf6426522aab56be490b66c2436 -r6ad7855cd7aba089f7a160293802e1639d0d6198 --- doc/example-scripts/traits-simple.html (.../traits-simple.html) (revision 2076ef459f42cdf6426522aab56be490b66c2436) +++ doc/example-scripts/traits-simple.html (.../traits-simple.html) (revision 6ad7855cd7aba089f7a160293802e1639d0d6198) @@ -783,7 +783,7 @@ :requiredVariables collection }

Define the class ReadStream with properties position and -collection that uses the trait. The method useTrait checks the +collection that uses the trait. The method require trait checks the requirements of the trait and imports the methods into ReadStream.