rename writeln to writeLine in doc
This commit is contained in:
parent
15e7fe787a
commit
b6252af5c6
6 changed files with 33 additions and 33 deletions
|
|
@ -53,7 +53,7 @@ The following example shows a generic binary tree can be modelled:
|
|||
add(root, newNode("hallo")) # instantiates generic procs ``newNode`` and
|
||||
add(root, newNode("world")) # ``add``
|
||||
for str in inorder(root):
|
||||
writeln(stdout, str)
|
||||
writeLine(stdout, str)
|
||||
|
||||
|
||||
Is operator
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ to supply any type of first argument for procedures:
|
|||
echo("abc".len) # is the same as echo(len("abc"))
|
||||
echo("abc".toUpper())
|
||||
echo({'a', 'b', 'c'}.card)
|
||||
stdout.writeln("Hallo") # the same as writeln(stdout, "Hallo")
|
||||
stdout.writeLine("Hallo") # the same as writeLine(stdout, "Hallo")
|
||||
|
||||
Another way to look at the method call syntax is that it provides the missing
|
||||
postfix notation.
|
||||
|
|
|
|||
|
|
@ -77,10 +77,10 @@ special ``:`` syntax:
|
|||
quit("cannot open: " & fn)
|
||||
|
||||
withFile(txt, "ttempl3.txt", fmWrite):
|
||||
txt.writeln("line 1")
|
||||
txt.writeln("line 2")
|
||||
txt.writeLine("line 1")
|
||||
txt.writeLine("line 2")
|
||||
|
||||
In the example the two ``writeln`` statements are bound to the ``actions``
|
||||
In the example the two ``writeLine`` statements are bound to the ``actions``
|
||||
parameter.
|
||||
|
||||
|
||||
|
|
@ -206,8 +206,8 @@ template parameter, it is an inject'ed symbol:
|
|||
...
|
||||
|
||||
withFile(txt, "ttempl3.txt", fmWrite):
|
||||
txt.writeln("line 1")
|
||||
txt.writeln("line 2")
|
||||
txt.writeLine("line 1")
|
||||
txt.writeLine("line 2")
|
||||
|
||||
|
||||
The ``inject`` and ``gensym`` pragmas are second class annotations; they have
|
||||
|
|
@ -299,7 +299,7 @@ variable number of arguments:
|
|||
# add a call to the statement list that writes ": "
|
||||
add(result, newCall("write", newIdentNode("stdout"), newStrLitNode(": ")))
|
||||
# add a call to the statement list that writes the expressions value:
|
||||
add(result, newCall("writeln", newIdentNode("stdout"), n[i]))
|
||||
add(result, newCall("writeLine", newIdentNode("stdout"), n[i]))
|
||||
|
||||
var
|
||||
a: array [0..10, int]
|
||||
|
|
@ -314,15 +314,15 @@ The macro call expands to:
|
|||
.. code-block:: nim
|
||||
write(stdout, "a[0]")
|
||||
write(stdout, ": ")
|
||||
writeln(stdout, a[0])
|
||||
writeLine(stdout, a[0])
|
||||
|
||||
write(stdout, "a[1]")
|
||||
write(stdout, ": ")
|
||||
writeln(stdout, a[1])
|
||||
writeLine(stdout, a[1])
|
||||
|
||||
write(stdout, "x")
|
||||
write(stdout, ": ")
|
||||
writeln(stdout, x)
|
||||
writeLine(stdout, x)
|
||||
|
||||
|
||||
Arguments that are passed to a ``varargs`` parameter are wrapped in an array
|
||||
|
|
@ -333,7 +333,7 @@ children.
|
|||
BindSym
|
||||
-------
|
||||
|
||||
The above ``debug`` macro relies on the fact that ``write``, ``writeln`` and
|
||||
The above ``debug`` macro relies on the fact that ``write``, ``writeLine`` and
|
||||
``stdout`` are declared in the system module and thus visible in the
|
||||
instantiating context. There is a way to use bound identifiers
|
||||
(aka `symbols`:idx:) instead of using unbound identifiers. The ``bindSym``
|
||||
|
|
@ -348,7 +348,7 @@ builtin can be used for that:
|
|||
# we can bind symbols in scope via 'bindSym':
|
||||
add(result, newCall(bindSym"write", bindSym"stdout", toStrLit(n[i])))
|
||||
add(result, newCall(bindSym"write", bindSym"stdout", newStrLitNode(": ")))
|
||||
add(result, newCall(bindSym"writeln", bindSym"stdout", n[i]))
|
||||
add(result, newCall(bindSym"writeLine", bindSym"stdout", n[i]))
|
||||
|
||||
var
|
||||
a: array [0..10, int]
|
||||
|
|
@ -363,17 +363,17 @@ The macro call expands to:
|
|||
.. code-block:: nim
|
||||
write(stdout, "a[0]")
|
||||
write(stdout, ": ")
|
||||
writeln(stdout, a[0])
|
||||
writeLine(stdout, a[0])
|
||||
|
||||
write(stdout, "a[1]")
|
||||
write(stdout, ": ")
|
||||
writeln(stdout, a[1])
|
||||
writeLine(stdout, a[1])
|
||||
|
||||
write(stdout, "x")
|
||||
write(stdout, ": ")
|
||||
writeln(stdout, x)
|
||||
writeLine(stdout, x)
|
||||
|
||||
However, the symbols ``write``, ``writeln`` and ``stdout`` are already bound
|
||||
However, the symbols ``write``, ``writeLine`` and ``stdout`` are already bound
|
||||
and are not looked up again. As the example shows, ``bindSym`` does work with
|
||||
overloaded symbols implicitly.
|
||||
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ parameter is of the type ``varargs`` it is treated specially and it can match
|
|||
.. code-block:: nim
|
||||
template optWrite{
|
||||
write(f, x)
|
||||
((write|writeln){w})(f, y)
|
||||
((write|writeLine){w})(f, y)
|
||||
}(x, y: varargs[expr], f: File, w: expr) =
|
||||
w(f, x, y)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue