mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-15 23:54:19 +00:00
updated the documentation for the 'do' notation
This commit is contained in:
@@ -236,8 +236,6 @@ executable code.
|
||||
Do notation
|
||||
-----------
|
||||
|
||||
**Note:** The future of the ``do`` notation is uncertain.
|
||||
|
||||
As a special more convenient notation, proc expressions involved in procedure
|
||||
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.
|
||||
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
|
||||
proc performWithUndo(task: proc(), undo: proc()) = ...
|
||||
macro performWithUndo(task, undo: untyped) = ...
|
||||
|
||||
performWithUndo do:
|
||||
# multiple-line block of code
|
||||
|
||||
1
todo.txt
1
todo.txt
@@ -4,7 +4,6 @@ essential for 1.0
|
||||
- introduce newSeqOfCap(10)
|
||||
- annotation support for getType()
|
||||
- overloading of `()` needs to be in .experimental
|
||||
- do notation needs to be documented properly
|
||||
- find a solution for the x.f[T](y) gotcha
|
||||
- ``concept`` needs to be refined, a nice name for the feature is not enough.
|
||||
- Destructors need to be refined.
|
||||
|
||||
Reference in New Issue
Block a user