Skip to content

Commit

Permalink
Merge pull request #8587 from dletozeun/patch-1
Browse files Browse the repository at this point in the history
Update modules.rst
  • Loading branch information
jiahao committed Oct 11, 2014
2 parents 1a4c02f + bb44212 commit 1df061c
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions doc/manual/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,24 @@ To load a module, two main keywords can be used: ``using`` and ``import``. To un

In this module we export the ``x`` and ``y`` functions (with the keyword ``export``), and also have the non-exported function ``p``. There are several different ways to load the Module and its inner functions into the current workspace:

+------------------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------------------------+
|Import Command | What is brought into scope | Available for method extension |
+====================================+==============================================================================================+========================================================================+
| ``using MyModule`` | All ``export`` ed names (``x`` and ``y``), ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` |
+------------------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------------------------+
| ``using MyModule.x, MyModule.p`` | ``x`` and ``p`` | |
+------------------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------------------------+
| ``using MyModule: x, p`` | ``x`` and ``p`` | |
+------------------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------------------------+
| ``import MyModule`` | ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` |
+------------------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------------------------+
| ``import MyModule.x, MyModule.p`` | ``x`` and ``p`` | ``x`` and ``p`` |
+------------------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------------------------+
| ``import MyModule: x, p`` | ``x`` and ``p`` | ``x`` and ``p`` |
+------------------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------------------------+
| ``importall MyModule`` | All ``export`` ed names (``x`` and ``y``) | ``x`` and ``y`` |
+------------------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------------------------+
+------------------------------------+-------------------------------------+---------------------------------------------------+
|Import Command | What is brought into scope | Available for method extension |
+====================================+=====================================+===================================================+
| ``using MyModule`` | ``x``, ``y``, ``MyModule.*`` | ``MyModule.*`` |
+------------------------------------+-------------------------------------+---------------------------------------------------+
| ``using MyModule.x, MyModule.p`` | ``x``, ``p``, ``MyModule.*`` | ``MyModule.*`` |
+------------------------------------+-------------------------------------+---------------------------------------------------+
| ``using MyModule: x, p`` | ``x``, ``p``, ``MyModule.*`` | ``MyModule.*`` |
+------------------------------------+-------------------------------------+---------------------------------------------------+
| ``import MyModule`` | ``MyModule.*`` | ``MyModule.*`` |
+------------------------------------+-------------------------------------+---------------------------------------------------+
| ``import MyModule.x, MyModule.p`` | ``x``, ``p``, ``MyModule.*`` | ``x``, ``p``, ``MyModule.*`` |
+------------------------------------+-------------------------------------+---------------------------------------------------+
| ``import MyModule: x, p`` | ``x``, ``p``, ``MyModule.*`` | ``x``, ``p``, ``MyModule.*`` |
+------------------------------------+-------------------------------------+---------------------------------------------------+
| ``importall MyModule`` | ``x``, ``y``, ``MyModule.*`` | ``x``, ``y``, ``MyModule.*`` |
+------------------------------------+-------------------------------------+---------------------------------------------------+
Note: In all cases, ``MyModule.*`` (i.e. ``MyModule.x``, ``MyModule.y`` and ``MyModule.p``) are loaded into current workspace and it is possible to add methods to them.


Modules and files
Expand Down

0 comments on commit 1df061c

Please sign in to comment.