updated the documentation for the 'do' notation
This commit is contained in:
parent
00651d4afc
commit
2910096cce
2 changed files with 4 additions and 5 deletions
|
|
@ -236,8 +236,6 @@ executable code.
|
||||||
Do notation
|
Do notation
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
**Note:** The future of the ``do`` notation is uncertain.
|
|
||||||
|
|
||||||
As a special more convenient notation, proc expressions involved in procedure
|
As a special more convenient notation, proc expressions involved in procedure
|
||||||
calls can use the ``do`` keyword:
|
calls can use the ``do`` keyword:
|
||||||
|
|
||||||
|
|
@ -251,10 +249,12 @@ calls can use the ``do`` keyword:
|
||||||
``do`` is written after the parentheses enclosing the regular proc params.
|
``do`` is written after the parentheses enclosing the regular proc params.
|
||||||
The proc expression represented by the do block is appended to them.
|
The proc expression represented by the do block is appended to them.
|
||||||
|
|
||||||
More than one ``do`` block can appear in a single call:
|
``do`` with parentheses is an anonymous ``proc``; however a ``do`` without
|
||||||
|
parentheses is just a block of code. The ``do`` notation can be used to
|
||||||
|
pass multiple blocks to a macro:
|
||||||
|
|
||||||
.. code-block:: nim
|
.. code-block:: nim
|
||||||
proc performWithUndo(task: proc(), undo: proc()) = ...
|
macro performWithUndo(task, undo: untyped) = ...
|
||||||
|
|
||||||
performWithUndo do:
|
performWithUndo do:
|
||||||
# multiple-line block of code
|
# multiple-line block of code
|
||||||
|
|
|
||||||
1
todo.txt
1
todo.txt
|
|
@ -4,7 +4,6 @@ essential for 1.0
|
||||||
- introduce newSeqOfCap(10)
|
- introduce newSeqOfCap(10)
|
||||||
- annotation support for getType()
|
- annotation support for getType()
|
||||||
- overloading of `()` needs to be in .experimental
|
- overloading of `()` needs to be in .experimental
|
||||||
- do notation needs to be documented properly
|
|
||||||
- find a solution for the x.f[T](y) gotcha
|
- find a solution for the x.f[T](y) gotcha
|
||||||
- ``concept`` needs to be refined, a nice name for the feature is not enough.
|
- ``concept`` needs to be refined, a nice name for the feature is not enough.
|
||||||
- Destructors need to be refined.
|
- Destructors need to be refined.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue