summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-01-18 01:16:45 +0100
committerAraq <rumpf_a@web.de>2014-01-18 01:16:45 +0100
commit36afdca87f3757c8468cbfa622de693447df7e07 (patch)
tree3b739b667574c12dea389a17d9d84291fd355463 /lib/system.nim
parent5073914b8697a9fd1dc38bebef434b50850f2861 (diff)
parent3f8bfb1e988322ab60cc54184d63a00906260665 (diff)
downloadNim-36afdca87f3757c8468cbfa622de693447df7e07.tar.gz
resolved conflicts with master
Diffstat (limited to 'lib/system.nim')
-rw-r--r--lib/system.nim19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 70c8a529a..75bebf702 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -2708,7 +2708,23 @@ proc locals*(): TObject {.magic: "Locals", noSideEffect.} =
   ## in the current scope. This is quite fast as it does not rely
   ## on any debug or runtime information. Note that in constrast to what
   ## the official signature says, the return type is not ``TObject`` but a
-  ## tuple of a structure that depends on the current scope.
+  ## tuple of a structure that depends on the current scope. Example:
+  ##
+  ## .. code-block:: nimrod
+  ##   proc testLocals() =
+  ##     var
+  ##       a = "something"
+  ##       b = 4
+  ##       c = locals()
+  ##       d = "super!"
+  ##
+  ##     b = 1
+  ##     for name, value in fieldPairs(c):
+  ##       echo "name ", name, " with value ", value
+  ##     echo "B is ", b
+  ##   # -> name a with value something
+  ##   # -> name b with value 4
+  ##   # -> B is 1
   discard
 
 when not defined(booting):
@@ -2719,4 +2735,3 @@ when not defined(booting):
 
   template isStatic*(x): expr = compiles(static(x))
     # checks whether `x` is a value known at compile-time
-