rename writeln to writeLine in doc

This commit is contained in:
patrick dw
2015-06-19 01:08:41 -05:00
parent 15e7fe787a
commit b6252af5c6
6 changed files with 33 additions and 33 deletions

View File

@@ -222,13 +222,13 @@ Call with named arguments
Concrete syntax:
.. code-block:: nim
writeln(file=stdout, "hallo")
writeLine(file=stdout, "hallo")
AST:
.. code-block:: nim
nnkCall(
nnkIdent(!"writeln"),
nnkIdent(!"writeLine"),
nnkExprEqExpr(
nnkIdent(!"file"),
nnkIdent(!"stdout")

View File

@@ -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

View File

@@ -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.

View File

@@ -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.

View File

@@ -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)

View File

@@ -207,7 +207,7 @@ for any type:
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.)
@@ -217,9 +217,9 @@ So "pure object oriented" code is easy to write:
.. code-block:: nim
import strutils
stdout.writeln("Give a list of numbers (separated by spaces): ")
stdout.writeLine("Give a list of numbers (separated by spaces): ")
stdout.write(stdin.readLine.split.map(parseInt).max.`$`)
stdout.writeln(" is the maximum!")
stdout.writeLine(" is the maximum!")
Properties
@@ -535,7 +535,7 @@ containers:
add(root, newNode("hello")) # instantiates ``newNode`` and ``add``
add(root, "world") # instantiates the second ``add`` proc
for str in preorder(root):
stdout.writeln(str)
stdout.writeLine(str)
The example shows a generic binary tree. Depending on context, the brackets are
used either to introduce type parameters or to instantiate a generic proc,
@@ -580,7 +580,7 @@ simple proc for logging:
debug = true
proc log(msg: string) {.inline.} =
if debug: stdout.writeln(msg)
if debug: stdout.writeLine(msg)
var
x = 4
@@ -597,7 +597,7 @@ Turning the ``log`` proc into a template solves this problem:
debug = true
template log(msg: string) =
if debug: stdout.writeln(msg)
if debug: stdout.writeLine(msg)
var
x = 4
@@ -627,10 +627,10 @@ via a 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 ``body``
In the example the two ``writeLine`` statements are bound to the ``body``
parameter. The ``withFile`` template contains boilerplate code and helps to
avoid a common bug: to forget to close the file. Note how the
``let fn = filename`` statement ensures that ``filename`` is evaluated only
@@ -684,7 +684,7 @@ variable number of arguments:
# add a call to the statement list that writes ": "
result.add(newCall("write", newIdentNode("stdout"), newStrLitNode(": ")))
# add a call to the statement list that writes the expressions value:
result.add(newCall("writeln", newIdentNode("stdout"), n[i]))
result.add(newCall("writeLine", newIdentNode("stdout"), n[i]))
var
a: array[0..10, int]
@@ -699,15 +699,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)