summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-04-09 22:16:52 +0200
committerAraq <rumpf_a@web.de>2019-04-09 22:16:52 +0200
commit4974f999c36627c21a001c8acf7d036f80d0121f (patch)
treed818a806a683b8a51d5cea57fecda32235a67c47
parent72408842d9ca79e9b64691bb8fa906a3e1014a43 (diff)
downloadNim-4974f999c36627c21a001c8acf7d036f80d0121f.tar.gz
manual: make currency example compile and ensure it remains working
-rw-r--r--doc/manual.rst8
1 files changed, 5 insertions, 3 deletions
diff --git a/doc/manual.rst b/doc/manual.rst
index d9112652b..0a67dd3fa 100644
--- a/doc/manual.rst
+++ b/doc/manual.rst
@@ -1858,7 +1858,9 @@ But it seems all this boilerplate code needs to be repeated for the ``Euro``
 currency. This can be solved with templates_.
 
 .. code-block:: nim
-  template additive(typ: type) =
+    :test: "nim c $1"
+
+  template additive(typ: typedesc) =
     proc `+` *(x, y: typ): typ {.borrow.}
     proc `-` *(x, y: typ): typ {.borrow.}
 
@@ -1866,13 +1868,13 @@ currency. This can be solved with templates_.
     proc `+` *(x: typ): typ {.borrow.}
     proc `-` *(x: typ): typ {.borrow.}
 
-  template multiplicative(typ, base: type) =
+  template multiplicative(typ, base: typedesc) =
     proc `*` *(x: typ, y: base): typ {.borrow.}
     proc `*` *(x: base, y: typ): typ {.borrow.}
     proc `div` *(x: typ, y: base): typ {.borrow.}
     proc `mod` *(x: typ, y: base): typ {.borrow.}
 
-  template comparable(typ: type) =
+  template comparable(typ: typedesc) =
     proc `<` * (x, y: typ): bool {.borrow.}
     proc `<=` * (x, y: typ): bool {.borrow.}
     proc `==` * (x, y: typ): bool {.borrow.}