-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Alternate proposal for a better module system #8015
Comments
The |
|
@jkroso that looks interesting, I've just made https://github.com/jkroso/Require.jl/issues/1 to try to understand your system more. |
@jkroso That does look very interesting! I wondering a bit about the way lookup works, but I need to study it a bit more to really discuss. In any case, very very promising!!! And it's damn cool that you actually implemented it 👍 |
@trans yea It came out better than I had hoped. I even like the macro syntax better than julia's built in |
That's a cool experiment, @jkroso – thanks for posting it. The biggest problem I have with |
I think the modules Julia has are good I've just changed the way they are loaded and installed. Now I think everything is perfect. Everything should continue to work fine at the REPL. |
@jkroso very nice work! I especially appreciate your in-hindsight-obvious observation that file-modules and syntactically-delimited modules aren't mutually exclusive. I agree we could do with some load-and-path-related tweaking. Some of these ideas are very good candidates for changes to the built-in module system. |
This might be of interest, in general: http://isocpp.org/files/papers/n4214.pdf |
This is my second proposal for a better module system for Julia. Reading my first proposal (#8014) will be helpful in understanding this proposal. This proposal has the same goals as the first, but unlike the first is simpler and consequently has some limitations --but it may be that those limitation are not significant ones.
What this proposal does is equate modules and files. Thus there is no need to declare
module Foo
in a file. So that's convenient. But is also means that no file can have more than one module defined in it. For the sake of clarity I will call thesemodule-files
so not to confuse them with the terms of the first proposal.Loading a module-file and using a module-file is one and the same action.
And just like that all of Bar's exported functions are available to Foo. We can of course load specific functions as before.
To get the an "absolute" handle on a module we assign it.
"Reopening" a module is a little trickier in this proposal, but it should still be possible via an absolute handle. e.g.
Interestingly however, this could be made to effect only a local "version" of Bar vs all imports of Bar. That question is left open.
Loading files works as in the first proposal. Local files are searched first, and then packages, unless a package is clearly specified, e.g.
The exact syntax of
|
not withstanding.This proposal is clearly much simpler than the first. In fact, it is probably as simple as a module system can get, which is kind of nice. It does have some limitations, in particular that each module must be define in it own file. But that may actually be a benefit as it make it very clear where code resides.
The text was updated successfully, but these errors were encountered: