diff options
author | apense <apense@users.noreply.github.com> | 2015-06-15 18:35:05 -0400 |
---|---|---|
committer | apense <apense@users.noreply.github.com> | 2015-06-15 18:35:05 -0400 |
commit | 998f1fa67a2f4c0c28f387d969941464018d61e7 (patch) | |
tree | 9a4cb46cbd91d6f513855c8bfa7dcd18133ee7cb | |
parent | 8c8e975bcd286b41e8308a6deab0f1d00849c681 (diff) | |
download | Nim-998f1fa67a2f4c0c28f387d969941464018d61e7.tar.gz |
Minor updates; addition of `var` return in procs
-rw-r--r-- | doc/astspec.txt | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/doc/astspec.txt b/doc/astspec.txt index ef0c91bb8..50dfda1bc 100644 --- a/doc/astspec.txt +++ b/doc/astspec.txt @@ -762,6 +762,10 @@ Note that either the second or third (or both) parameters above must exist, as the compiler needs to know the type somehow (which it can infer from the given assignment). +This is not the same AST for all uses of ``var``. See +[Procedure declaration](http://nim-lang.org/docs/macros.html#statements-procedure-declaration) +for details. + Let section ----------- @@ -899,6 +903,32 @@ AST: ) # ... +Mixin statement +--------------- + +Concrete syntax: + +.. code-block:: nim + mixin x + +AST: + +.. code-block:: nim + nnkMixinStmt(nnkIdent(!"x")) + +Bind statement +-------------- + +Concrete syntax: + +.. code-block:: nim + bind x + +AST: + +.. code-block:: nim + nnkBindStmt(nnkIdent(!"x")) + Procedure declaration --------------------- @@ -963,6 +993,24 @@ AST: ), # ... +When a procedure uses the special ``var`` type return variable, the result +is different from that of a var section. + +Concrete syntax: + +.. code-block:: nim + proc hello(): var int + +AST: + +.. code-block:: nim + # ... + nnkFormalParams( + nnkVarTy( + nnkIdent(!"int") + ) + ) + Iterator declaration -------------------- |