-
Notifications
You must be signed in to change notification settings - Fork 11
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
Reexport functionality. #25
Comments
Are you suggesting something like
that combines That seems reasonable -- I think we'd be happy to accept a PR on that. |
Yes, something along that line. Maybe more readable: |
Ah, yes. I agree that would be the neatest syntax. As I say, happy to accept a PR on that. |
I'm happy to compile PR. I'll have to catch up on meta programming first though. |
It's shorter but I think this could be ambiguous, it's not obvious to me whether the exported symbols get into the current module scope:
A more explicit syntax could be @from "file.jl" import foo, baz export ... I believe the major problem of or just support a @reexport "file.jl"
@reexport A I think this is probably the cleanest syntax since Julia itself doesn't have the reexport syntax, and it is consistent with the proposal that treating "file"s as "module"s |
These are reasonable points. Personally I think I'd still prefer it over
I do feel quite strongly that this would be the wrong way to go. One of the big advantages of the current approach is that it's made explicit what is imported/exported. I find this is consistently a huge help when navigating a code base. Something like this would mean we lose that advantage. |
I like the I agree that a plain |
To that point, can a syntax like julia> :(export ...)
ERROR: syntax: invalid identifier name "..."
Stacktrace:
[1] top-level scope
@ none:1 |
Okay, that's kind of fun. Playing with this a bit: julia> x = :(exporta ...)
:(exporta...)
julia> x.head
:...
julia> x.args
1-element Array{Any,1}:
:exporta
julia> y = :(export asdf)
:(export asdf)
julia> y.head
:export
julia> y.args
1-element Array{Any,1}:
:asdf
julia> :(exporta asdf)
ERROR: syntax: missing comma or ) in argument list
Stacktrace:
[1] top-level scope at none:1 That is to say, There's also this: julia> :(.)
:.
julia> :(..)
:..
julia> :(...)
:...
julia> :(....)
ERROR: syntax: invalid identifier name "..."
Stacktrace:
[1] top-level scope at none:1 Off the top of my head I'm not familiar with the details of what's going on here. Probably we'd need to experiment a bit to figure out what's going on. Which, incidentally, is an answer to your question over in #26 -- my own experience with Julia metaprogramming has been mostly a trial-and-error process of seeing what works. Beyond that there is the devdocs on the AST. This short discourse thread is also interesting. |
I see your point, one may only want to export a selected list of names from one file, now I see |
As stated in #26 I think it makes sense to move this feature to Reexport.jl. Thus, I'm closing this issue. |
Reexport 1.2 now is composable with |
First of all, thank you for this awesome package. It is a great prototype of saner code loading and I have really enjoyed it so far.
I was wondering whether it makes sense to add some reexport functionality to this package. I find my module file consisting solely of code like
Thus, it would be nice to have a re-export capability on this level. Maybe this is also beyond the scope of this package and would come more naturally if similar syntax would make it into Base. In that case the requested functionality would perhaps be best added to Reexport.jl. But until then, if it ever happens, it may be nice to have this functionality here.
The text was updated successfully, but these errors were encountered: