updated manual for declared()
This commit is contained in:
parent
8062698e7f
commit
47726ecb9e
1 changed files with 14 additions and 0 deletions
|
|
@ -6896,6 +6896,20 @@ level:
|
||||||
|
|
||||||
a() # outputs: "5"
|
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
|
It is important to note that reordering *only* works for symbols at top level
|
||||||
scope. Therefore, the following will *fail to compile:*
|
scope. Therefore, the following will *fail to compile:*
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue