Index: doc/tutorial.html =================================================================== diff -u -rd0046301203f85ab94d2ecb0ba86b2b386cc7440 -r609d144413786df160f834692e7b571d0d5a92d8 --- doc/tutorial.html (.../tutorial.html) (revision d0046301203f85ab94d2ecb0ba86b2b386cc7440) +++ doc/tutorial.html (.../tutorial.html) (revision 609d144413786df160f834692e7b571d0d5a92d8) @@ -352,11 +352,7 @@ # Object create stack -stack proc init {} { - # Constructor - my instvar things - set things "" -} +stack set things "" stack proc push {thing} { my instvar things @@ -376,7 +372,7 @@

 
Refining the behavior of objects and classes

-

So far, the definition of stacks were pretty minimal. Suppose, we want to define safe stacks, that check e.g. for stack underruns (more pop the push operations are issued). Checking safety can be done mostly independent from the implementation details of the stack (usage of internal data structures). +

So far, the definition of stacks were pretty minimal. Suppose, we want to define safe stacks, that check e.g. for stack underruns (more pop than push operations are issued). Checking safety can be done mostly independent from the implementation details of the stack (usage of internal data structures). With XOTcl, one can define stack-safety as a separate class using methods with the same names as the implementations before, and "mix" this behavior later into classes or objects. The implementation of Safety uses a counter to check for stack underruns.

@@ -416,19 +412,13 @@
 Stack empty!
 
-Note that the definition of Saftey can be used not only for instances of the class Stack, but for arbitrary objects supporting the same interface. Therefore we could as well make the stack object stack (that we created before) safe at any time by adding the safety at arbitrary times with the method mixin, and we can remove the safety as well at any time. +Note that the definition of Saftey can be used not only for instances +of the class Stack, but for arbitrary objects supporting the +same interface. We can as well use Saftey to create a new +class SafeStack. In this case, all instances of +SafeStack have the safety property defined above.
-# Add Safety to the object stack
-% stack mixin Safety
-...
-% stack push a
-...
-# remove Safety
-% stack mixin {}
-
-We can as well use Saftey to create a new class SafeStack. In this case, all instances of SafeStack have the safety property defined above. -
 #
 # Create a safe stack class by using Stack and mixin 
 # Safety