summary refs log tree commit diff stats
path: root/doc
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-12-01 19:10:47 +0100
committerAraq <rumpf_a@web.de>2012-12-01 19:10:47 +0100
commitc98e3d2c274ac4bd4227d4e3f7e0d2636827f88c (patch)
treec9b624562ae38f56d19e7ed190307caea8c61241 /doc
parentf503439e811d822f19daa9591cb3bd9e90edabe7 (diff)
downloadNim-c98e3d2c274ac4bd4227d4e3f7e0d2636827f88c.tar.gz
implements 'export' feature
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/manual.txt31
1 files changed, 29 insertions, 2 deletions
diff --git a/doc/manual.txt b/doc/manual.txt
index a5bce775b..5ea3575ee 100755
--- a/doc/manual.txt
+++ b/doc/manual.txt
@@ -3656,7 +3656,7 @@ don't need to instantiate the code multiple times, because types then can be
 manipulated using the unified internal symbol representation. In such context
 typedesc acts as any other type. You can create variables, store typedesc
 values inside containers and so on. For example, here is how we can create 
-a type-safe wrapper for the unsafe `printf` function form C:
+a type-safe wrapper for the unsafe `printf` function from C:
 
 .. code-block:: nimrod
   macro safePrintF(formatString: string{lit}, args: vararg[expr]): expr =
@@ -3744,7 +3744,7 @@ This is best illustrated by an example:
 Import statement
 ~~~~~~~~~~~~~~~~
 
-After the import statement a list of module names can follow or a single
+After the `import`:idx: statement a list of module names can follow or a single
 module name followed by an ``except`` to prevent some symbols to be imported:
 
 .. code-block:: nimrod
@@ -3754,6 +3754,33 @@ module name followed by an ``except`` to prevent some symbols to be imported:
   echo "$1" % "abc"
 
 
+Export statement
+~~~~~~~~~~~~~~~~
+
+An `export`:idx: statement can be used for symbol fowarding so that client
+modules don't need to import a module's dependencies:
+
+.. code-block:: nimrod
+  # module B
+  type TMyObject* = object
+
+.. code-block:: nimrod
+  # module A
+  import B
+  export B.TMyObject
+  
+  proc `$`*(x: TMyObject): string = "my object"
+
+
+.. code-block:: nimrod
+  # module C
+  import A
+  
+  # B.TMyObject has been imported implicitly here: 
+  var x: TMyObject
+  echo($x)
+
+
 Scope rules
 -----------
 Identifiers are valid from the point of their declaration until the end of