From 48d8728e406155f33898098ef7df3165591babe8 Mon Sep 17 00:00:00 2001 From: Araq Date: Mon, 14 Sep 2015 12:46:43 +0200 Subject: [PATCH] documented implicit compileTime procs --- doc/manual/pragmas.txt | 15 ++++++++++++++- web/news.txt | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/manual/pragmas.txt b/doc/manual/pragmas.txt index 8166994a9..68a88f865 100644 --- a/doc/manual/pragmas.txt +++ b/doc/manual/pragmas.txt @@ -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 --------------- diff --git a/web/news.txt b/web/news.txt index 225211a65..2aeaeeaed 100644 --- a/web/news.txt +++ b/web/news.txt @@ -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 `_ 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