* fixes #10912

* update the tutorial examples
This commit is contained in:
Andreas Rumpf 2019-05-24 18:33:53 +02:00 • committed by GitHub
commit ef8ddef47b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 6 deletions

View file

@ -277,7 +277,7 @@ Procedures always use static dispatch. For dynamic dispatch replace the
a, b: Expression
# watch out: 'eval' relies on dynamic binding
method eval(e: Expression): int =
method eval(e: Expression): int {.base.} =
# override this base method
quit "to override!"
@ -300,7 +300,7 @@ In a multi-method all parameters that have an object type are used for the
dispatching:
.. code-block:: nim
:test: "nim c $1"
:test: "nim c --multiMethods:on $1"
type
Thing = ref object of RootObj
@ -611,7 +611,7 @@ To pass a block of statements to a template, use 'untyped' for the last paramete
:test: "nim c $1"
template withFile(f: untyped, filename: string, mode: FileMode,
body: untyped): typed =
body: untyped) =
let fn = filename
var f: File
if open(f, fn, mode):