diff options
author | Daniel Kullmann <daniel.kullmann@gmx.de> | 2015-01-11 00:15:49 +0100 |
---|---|---|
committer | Daniel Kullmann <daniel.kullmann@gmx.de> | 2015-01-11 00:15:49 +0100 |
commit | 451b943a01276cf972b05c7f317752f3411a614c (patch) | |
tree | 598f3be14f4f481db8c5804eb892c53b355b6fa8 | |
parent | a41b62da970f9795cc4e8bc4fecbdb386dc18d80 (diff) | |
download | Nim-451b943a01276cf972b05c7f317752f3411a614c.tar.gz |
doc/tut2.txt: clarified usage of static/dynamic binding
The original text was slightly misleading in that it could be read that newLit and newPlus could not be implemented as methods; this is untrue, because newPlus could also be impleented as a method. The reason that newLit can't be implemented as a method is that its first argument (x: int) has a non-object type.
-rw-r--r-- | doc/tut2.txt | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/tut2.txt b/doc/tut2.txt index 2ae0f18f6..2948713e4 100644 --- a/doc/tut2.txt +++ b/doc/tut2.txt @@ -304,8 +304,8 @@ Procedures always use static dispatch. For dynamic dispatch replace the echo eval(newPlus(newPlus(newLit(1), newLit(2)), newLit(4))) Note that in the example the constructors ``newLit`` and ``newPlus`` are procs -because they should use static binding, but ``eval`` is a method because it -requires dynamic binding. +because it makes more sense for them to use static binding, but ``eval`` is a +method because it requires dynamic binding. In a multi-method all parameters that have an object type are used for the dispatching: |