mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 21:40:32 +00:00
documented implicit compileTime procs
This commit is contained in:
@@ -72,7 +72,20 @@ compileTime pragma
|
||||
------------------
|
||||
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
|
||||
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
|
||||
---------------
|
||||
|
||||
@@ -115,6 +115,9 @@ News
|
||||
this ``let (x, y) == f()`` still needs to be used.
|
||||
- ``when nimvm`` can now be used for compiletime versions of some code
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user