diff options
author | Zahary Karadjov <zahary@gmail.com> | 2017-07-18 11:50:06 +0300 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-08-19 08:57:43 +0200 |
commit | 7ad115f530942c0fc6718c146ee1a5a97ed61e6f (patch) | |
tree | 200af3aa9257690f92c6c91be478bfbbd17f1e51 /doc/manual | |
parent | c3e5c6c326747cf0acbe0e4f3d8dc71f9332a76e (diff) | |
download | Nim-7ad115f530942c0fc6718c146ee1a5a97ed61e6f.tar.gz |
Restore the old behavior of parsing "quote do:"
close #5845
Diffstat (limited to 'doc/manual')
-rw-r--r-- | doc/manual/procs.txt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/doc/manual/procs.txt b/doc/manual/procs.txt index 5f4c9f2fa..1ed12b8cf 100644 --- a/doc/manual/procs.txt +++ b/doc/manual/procs.txt @@ -248,12 +248,20 @@ calls can use the ``do`` keyword: .. code-block:: nim sort(cities) do (x,y: string) -> int: cmp(x.len, y.len) + # Less parenthesis using the method plus command syntax: cities = cities.map do (x:string) -> string: "City of " & x + # In macros, the do notation is often used for quasi-quoting + macroResults.add quote do: + if not `ex`: + echo `info`, ": Check failed: ", `expString` + ``do`` is written after the parentheses enclosing the regular proc params. The proc expression represented by the do block is appended to them. +In calls using the command syntax, the do block will bind to the immediately +preceeding expression, transforming it in a 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 |