This commit is contained in:
Araq 2014-11-15 11:10:13 +01:00
commit f7dca91344
8 changed files with 31 additions and 10 deletions

View file

@ -84,7 +84,9 @@ current module:
var exportedVar*: int
const exportedConst* = 78
type ExportedType* = distinct int
type
ExportedType* = object
exportedField*: int
Method call syntax
@ -107,6 +109,8 @@ to supply any type of first argument for procedures:
Another way to look at the method call syntax is that it provides the missing
postfix notation.
See also: `Limitations of the method call syntax`_.
Properties
----------

View file

@ -225,8 +225,8 @@ a template. ``inject`` and ``gensym`` have no effect in ``dirty`` templates.
Limitations of the method invokation syntax
-------------------------------------------
Limitations of the method call syntax
-------------------------------------
The expression ``x`` in ``x.f`` needs to be semantically checked (that means
symbol lookup and type checking) before it can be decided that it needs to be
@ -241,6 +241,21 @@ is used to invoke templates/macros:
unknownIdentifier.declareVar
Another common example is this:
.. code-block:: nim
from sequtils import toSeq
iterator something: string =
yield "Hello"
yield "World"
var info = something().toSeq()
The problem here is that the compiler already decided that ``something()`` as
an iterator is not callable in this context before ``toSeq`` gets its
chance to convert it into a sequence.
Macros
======