-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Allow using LongPackageName as LPN
and change export conventions.
#52821
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
base: master
Are you sure you want to change the base?
Conversation
…icitly load module name on `using Mod` or `using Mod as M`
I'm open to more test cases, this is surprisingly finicky. |
Dropping this link here as a TODO once we update JuliaSyntax and unblock this PR: review this discord thread and consider if/how the changes here impact that situation. EDIT: this PR would help that situation a wee bit but not address it much. |
Tagging triage because this would be a significant new syntax feature. |
I like this feature and think we should have it. Someone needs to implement. |
Triage likes it. My argument in favor of making One additional feature I'd like to see is that |
What is the intended use case here? In the REPL, or in package code? |
Stdlib: Pkg URL: https://github.com/JuliaLang/Pkg.jl.git Stdlib branch: master Julia branch: lh/using-as Old commit: 5432fdd30 New commit: 4c9b08431 Julia version: 1.13.0-DEV Pkg version: 1.12.0(Does not match) Bump invoked by: @LilithHafner Powered by: [BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl) Diff: JuliaLang/Pkg.jl@5432fdd...4c9b084 ``` $ git log --oneline 5432fdd30..4c9b08431 4c9b08431 Stop using the `module Mod; using Mod; end` pattern [NFC] (#3750) bde7ce039 also collect packages tracking a repo when "traversing" developed packages (#4198) ``` Co-authored-by: LilithHafner <60898866+LilithHafner@users.noreply.github.com>
Both, same as |
But (unlike I’m not thrilled about this. I don’t really think we should add new syntax that encourages people to disregard #42080 in package code. |
Also, FWIW, it wasn’t immediately obvious to me at first (just from looking at the syntax) that But that may just be me personally. I think I’m more concerned about the #42080 aspect. |
Before:
After:
This PR is implemented by
using
(i.e. creates an explicit imported const binding)using Mod as M
, add Mod to the list of "used" modules and create an explicit imported binding M => Mod.(non)breaking change 1
Base.isexported(Statistics, :Statistics)
will now return false (in Julia <=1.10 Base.isexported was not part of the public API)Base.ispublic(Statistics, :Statistics)
will now return false (in Julia <=1.10 Base.public was not defined)Breaking change 2
names(Mod)
currently no longer includes :Mod, I'd like to stop implicitly marking the module itself as public because I don't think Statistics.Statistics is something that should be public by default. Specifically, I think that in the package M1,The code
M1.API.M2.f()
depends on internals (the name of the module M2, which was never marked public)Breaking change 3
The code
now throws on
because the using statement tries and fails to create an explicit binding. This is a code pattern that is currently in use in Pkg.jl, but I do think it's a bit of an antipattern, and this PR creates a great workaround. However, maybe we should downgrade that into a warning.
Implements #52784 (resolves #52784)
Fixes #52817, Fixes #38521
Is a superset of and therefore closes #52810 (NFC)
Depends on JuliaLang/JuliaSyntax.jl#406
Depends on JuliaLang/Pkg.jl#3750