From fcc7d88c05c1540fc2883b022945e94330821bbc Mon Sep 17 00:00:00 2001 From: dletozeun Date: Sun, 5 Oct 2014 19:53:57 +0200 Subject: [PATCH 1/4] Update modules.rst Hello, reading the Julia modules documentation I found it a bit misleading IMHO. So I updated the summary table in a way that is showing that in any case, it is possible to overload the module functions when whole module or any of its function is brought into the current scope using "using" or "import" statements. Instead what changes is the cases "exports" are brought into scope or not and when it is possible to overload it or not. I am not a Julia export so please let me know if I am mistaken. --- doc/manual/modules.rst | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/doc/manual/modules.rst b/doc/manual/modules.rst index a06799b4188f71..91864b76193884 100644 --- a/doc/manual/modules.rst +++ b/doc/manual/modules.rst @@ -91,23 +91,23 @@ 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.x``, ``MyModule.y`` and ``MyModule.p`` | ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ++------------------------------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+ +| ``using MyModule.x, MyModule.p`` | ``x``, ``p``, ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ++------------------------------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+ +| ``using MyModule: x, p`` | ``x``, ``p``, ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ++------------------------------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+ +| ``import MyModule`` | ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ++------------------------------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+ +| ``import MyModule.x, MyModule.p`` | ``x``, ``p``, ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ``x``, ``p``, ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ++------------------------------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+ +| ``import MyModule: x, p`` | ``x``, ``p``, ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ``x``, ``p``, ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ++------------------------------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+ +| ``importall MyModule`` | ``x``, ``y``, ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ``x``, ``y``, ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ++------------------------------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+ Modules and files From 5c6047b52030ff4b0b1231dc45b7ba79ec8ec8b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Saffr=C3=A9?= Date: Fri, 10 Oct 2014 12:50:18 +0200 Subject: [PATCH 2/4] Update modules.rst --- doc/manual/modules.rst | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/doc/manual/modules.rst b/doc/manual/modules.rst index 91864b76193884..c349d0bfe155ac 100644 --- a/doc/manual/modules.rst +++ b/doc/manual/modules.rst @@ -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`` | ``x``, ``y``, ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | -+------------------------------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+ -| ``using MyModule.x, MyModule.p`` | ``x``, ``p``, ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | -+------------------------------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+ -| ``using MyModule: x, p`` | ``x``, ``p``, ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | -+------------------------------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+ -| ``import MyModule`` | ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | -+------------------------------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+ -| ``import MyModule.x, MyModule.p`` | ``x``, ``p``, ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ``x``, ``p``, ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | -+------------------------------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+ -| ``import MyModule: x, p`` | ``x``, ``p``, ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ``x``, ``p``, ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | -+------------------------------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+ -| ``importall MyModule`` | ``x``, ``y``, ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | ``x``, ``y``, ``MyModule.x``, ``MyModule.y`` and ``MyModule.p`` | -+------------------------------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+ ++------------------------------------+-------------------------------------+---------------------------------------------------+ +|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 From 24a0fc8b79e4add63f609338722b7b241a1a41a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Saffr=C3=A9?= Date: Fri, 10 Oct 2014 15:18:22 +0200 Subject: [PATCH 3/4] Update modules.rst fixed typo --- doc/manual/modules.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/manual/modules.rst b/doc/manual/modules.rst index c349d0bfe155ac..ffb390da709fb0 100644 --- a/doc/manual/modules.rst +++ b/doc/manual/modules.rst @@ -102,7 +102,7 @@ In this module we export the ``x`` and ``y`` functions (with the keyword ``expor +------------------------------------+-------------------------------------+---------------------------------------------------+ | ``import MyModule`` | ``MyModule.*`` | ``MyModule.*`` | +------------------------------------+-------------------------------------+---------------------------------------------------+ -| ``import MyModule.x, MyModule.p`` | ``x``, ``p`, ``MyModule.*`` | ``x``, ``p``, ``MyModule.*`` | +| ``import MyModule.x, MyModule.p`` | ``x``, ``p``, ``MyModule.*`` | ``x``, ``p``, ``MyModule.*`` | +------------------------------------+-------------------------------------+---------------------------------------------------+ | ``import MyModule: x, p`` | ``x``, ``p``, ``MyModule.*`` | ``x``, ``p``, ``MyModule.*`` | +------------------------------------+-------------------------------------+---------------------------------------------------+ From bb44212056e67c2011065282deccaae3243ea3e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Saffr=C3=A9?= Date: Fri, 10 Oct 2014 15:20:19 +0200 Subject: [PATCH 4/4] Update modules.rst fixed typo --- doc/manual/modules.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/manual/modules.rst b/doc/manual/modules.rst index ffb390da709fb0..db77b4268d9c64 100644 --- a/doc/manual/modules.rst +++ b/doc/manual/modules.rst @@ -102,7 +102,7 @@ In this module we export the ``x`` and ``y`` functions (with the keyword ``expor +------------------------------------+-------------------------------------+---------------------------------------------------+ | ``import MyModule`` | ``MyModule.*`` | ``MyModule.*`` | +------------------------------------+-------------------------------------+---------------------------------------------------+ -| ``import MyModule.x, MyModule.p`` | ``x``, ``p``, ``MyModule.*`` | ``x``, ``p``, ``MyModule.*`` | +| ``import MyModule.x, MyModule.p`` | ``x``, ``p``, ``MyModule.*`` | ``x``, ``p``, ``MyModule.*`` | +------------------------------------+-------------------------------------+---------------------------------------------------+ | ``import MyModule: x, p`` | ``x``, ``p``, ``MyModule.*`` | ``x``, ``p``, ``MyModule.*`` | +------------------------------------+-------------------------------------+---------------------------------------------------+