documented implicit compileTime procs
This commit is contained in:
parent
64d9a5bc85
commit
48d8728e40
2 changed files with 17 additions and 1 deletions
|
|
@ -72,7 +72,20 @@ compileTime pragma
|
||||||
------------------
|
------------------
|
||||||
The ``compileTime`` pragma is used to mark a proc or variable to be used at
|
The ``compileTime`` pragma is used to mark a proc or variable to be used at
|
||||||
compile time only. No code will be generated for it. Compile time procs are
|
compile time only. No code will be generated for it. Compile time procs are
|
||||||
useful as helpers for macros.
|
useful as helpers for macros. Since version 0.12.0 of the language, a proc
|
||||||
|
that uses ``system.NimNode`` within its parameter types is implictly declared
|
||||||
|
``compileTime``:
|
||||||
|
|
||||||
|
.. code-block:: nim
|
||||||
|
proc astHelper(n: NimNode): NimNode =
|
||||||
|
result = n
|
||||||
|
|
||||||
|
Is the same as:
|
||||||
|
|
||||||
|
.. code-block:: nim
|
||||||
|
proc astHelper(n: NimNode): NimNode {.compileTime.} =
|
||||||
|
result = n
|
||||||
|
|
||||||
|
|
||||||
noReturn pragma
|
noReturn pragma
|
||||||
---------------
|
---------------
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,9 @@ News
|
||||||
this ``let (x, y) == f()`` still needs to be used.
|
this ``let (x, y) == f()`` still needs to be used.
|
||||||
- ``when nimvm`` can now be used for compiletime versions of some code
|
- ``when nimvm`` can now be used for compiletime versions of some code
|
||||||
sections. Click `here <docs/manual.html#when-nimvm-statement>`_ for details.
|
sections. Click `here <docs/manual.html#when-nimvm-statement>`_ for details.
|
||||||
|
- Usage of the type ``NimNode`` in a proc now implicitly annotates the proc
|
||||||
|
with ``.compileTime``. This means generics work much better
|
||||||
|
for ``NimNode``.
|
||||||
|
|
||||||
|
|
||||||
Bugfixes
|
Bugfixes
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue