From 47726ecb9e4af38bfdad7f94f03d27385f2ac0f6 Mon Sep 17 00:00:00 2001 From: awr <41453959+awr1@users.noreply.github.com> Date: Tue, 4 Sep 2018 15:25:46 -0500 Subject: [PATCH] updated manual for declared() --- doc/manual.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/manual.rst b/doc/manual.rst index 26ff071d7d..e76cf3d78a 100644 --- a/doc/manual.rst +++ b/doc/manual.rst @@ -6896,6 +6896,20 @@ level: a() # outputs: "5" +The values of expressions involving `declared` are decided *before* the code +reordering process, and not after. As an example, the output of this code is +the same as it would be with code reordering disabled. + +.. code-block:: nim + {.reorder: on.} + + proc x() = + echo(declared(foo)) + + var foo = 4 + + x() # "false" + It is important to note that reordering *only* works for symbols at top level scope. Therefore, the following will *fail to compile:*