Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update modules.rst #8587

Merged
merged 4 commits into from
Oct 11, 2014
Merged

Update modules.rst #8587

merged 4 commits into from
Oct 11, 2014

Conversation

dletozeun
Copy link

Hello,

reading the Julia modules documentation I found the summary table 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 expert so please let me know if I am mistaken.

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.
@ivarne ivarne added the docs This change adds or pertains to documentation label Oct 5, 2014
@nolta
Copy link
Member

nolta commented Oct 6, 2014

I see your point, but i worry this patch makes the table harder to read because every cell would contain MyModule.x, MyModule.y, MyModule.p.

@dletozeun
Copy link
Author

Yes I agree, I had the same thought actually and I was thinking that maybe we could remove these "MyModule.x, MyModule.y, MyModule.p" and add a short notice after the table like:

Note: In all cases, MyModule.x, MyModule.y and MyModule.p are loaded into current workspace and it is possible to add methods to them.

@ivarne
Copy link
Member

ivarne commented Oct 6, 2014

Maybe we could write MyModule.* or something (with a note explaining that in this context * is all variables in MyModule, not just the multiplication operator)

@rfourquet
Copy link
Member

While the attention is on this table: it took me time to even notice that there is a third colum in this table (in the online docs): if I notice the scroll bar at all, it seems to me that it would only help to see one last variable in the first row and I won't bother to scroll. It's very boring to have to scroll when the webpage could already show everything. Could readthedocs be adjusted?

@dletozeun
Copy link
Author

There is an update of the documentation inspired from what was suggested in the above discussion.

jiahao added a commit that referenced this pull request Oct 11, 2014
@jiahao jiahao merged commit 1df061c into JuliaLang:master Oct 11, 2014
+------------------------------------+-------------------------------------+---------------------------------------------------+
| ``import MyModule`` | ``MyModule.*`` | ``MyModule.*`` |
+------------------------------------+-------------------------------------+---------------------------------------------------+
| ``import MyModule.x, MyModule.p`` | ``x``, ``p``, ``MyModule.*`` | ``x``, ``p``, ``MyModule.*`` |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect. import MyModule.x only makes x visible, not MyModule.

@JeffBezanson
Copy link
Member

Please revert.

@jiahao
Copy link
Member

jiahao commented Oct 11, 2014

Ugh, sorry. Clicked the wrong button.

@dletozeun
Copy link
Author

@JeffBezanson please correct me if I am wrong but here is what I did:

I created a file MyModule.jl then opened a julia console and typed: import MyModule.x.
After that, as expected x is brought into scope but also MyModule.x, MyModule.y and MyModule.p (See screenshot)

julia-import-module

@StefanKarpinski
Copy link
Member

@dletozeun, this is an (unfortunate) artifact of the fact that at the REPL, you are in the Main module, which is also the root module – where top-level module bindings are created. If you do the same thing in a module other than Main, you will not see a binding for MyModule in that module.

@dletozeun
Copy link
Author

@StefanKarpinski Oh I see, thank you for the clarification!

@dletozeun dletozeun deleted the patch-1 branch October 18, 2014 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants