-
-
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
Parser error when trying to add module scope to an export #14472
Comments
In this example, does Otherwise, I suppose this is equivalent to |
@timholy did the discussion on whether to extend |
No, it doesn't. Instead,
You can start reading here: |
I can change that |
Is there any progress here? I also want the export syntax like module Seq
module RE
type Regex
# ...
end
function matched(re::RegexMatch)
# ...
end
macro prosite_str(pat)
$(Regex(pat))
end
end # module RE
# this syntax is not supported!
export .RE.Regex, .RE.matched, .RE.@prosite_str
end # module Seq Or more compactly: # this syntax is not supported!
export .RE: Regex, matched, @prosite_str Note that this is really symmetrical to |
@bicycle1885, if should work if This issue is specific to a case where module |
@timholy Thank you. I know it is possible, but I'd like to It seems to me that your issue and my issue are very similar and can be solved in one fix. Should I open a new issue about my stuff? |
Simpler example: julia> module A
export fancy
fancy(x) = 2x
end
A
julia> module B
import A
fancy(x) = 3x
export A.fancy
end
ERROR: syntax: extra token "." after end of expression Here I'd like to have |
dup #1986 |
save
rather than its own save
While I see how my description seems similar to #1986, it's not really the same thing; I've clarified an important distinction in the title. I have no problems with listing the specific methods I want to export, I just want to control the module scope of the exports explicitly. But it's a parser error: julia> module A
export foo
foo() = 1
end
A
julia> module B
using A
foo() = 2
export A.foo
ERROR: syntax: extra token "." after end of expression
Didn't even let me finish the module definition. We're allowed to say |
save
rather than its own save
I'm not a schemer (and would have to re-teach myself the language to tackle this myself), but I suspect the fix is here. |
To clarify, I assume you want |
Sorry I missed your reply. Yes, you understood the request precisely. I hear you on the challenges. Presumably not 1.0 material? Or even 1.x? I recognize the potential for confusion here. |
(Note: clearer statement and example in #14472 (comment))
I'd like it if
using A
could export a symbol from moduleB
, using the module name as a qualifier:This has come up as an issue in the interaction between JLD and FileIO. FileIO exports
load
andsave
; after long discussion (CC @SimonDanisch), we decided that modules using FileIO should not extend these methods, but that FileIO should dispatch to unexported functions of the same name: in other words, FileIO should callJLD.save
, a function which is not exported by JLD, even though JLD hasusing FileIO
in its definition.The problems come when a module like JLD wants to (perhaps for backwards-compatibility reasons) export FileIO's
save
rather than its ownsave
.Simple example:
But if I uncomment that
export
line, I getObviously we could solve this by calling the internal method
_save
, but at this point it would be nicer not to have to change our expectations of packages that use FileIO.Since this looks like a parser error, I'm wondering whether this could be fixed by changing the parser? Or would this introduce some other kind of problem?
Mildly related: #1986.
The text was updated successfully, but these errors were encountered: