-
-
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
inference: minor refactor for compiler/reflection code #40745
Conversation
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Is the API break here intentional? E.g. FluxML/IRTools.jl#86 . (Not sure what's the policy about renaming non-exported functions in Base. Feel free to disregard if this one is okay.) |
Sorry breaking the code, but the function is neither exported nor documented, and so it's the responsibility of third-party I'd like to make sure to check an impact of renaming with JuliaHub's code search in the future, though. |
My worry is: if we can find reverse dependencies in public code (like here) then there's also probably reverse dependencies in people's private code. It also seems like the rename is for cosmetic reasons, and that's not a very strong reason to risk it.
Is this rule documented? Elsewhere Context: I had a similar situation pointed out to me in #34719. I just re-added the functions. |
The documentation says "It is common to export names which form part of the API (application programming interface). ... However, since qualified names always make identifiers accessible, this is just an option for organizing APIs: unlike other languages, Julia has no facilities for truly hiding module internals." ... But I'm not sure honestly. @StefanKarpinski @JeffBezanson can either of you give us your opinion on this ? What's the canonical view on the line between
I think I can show you how we can extensibly detect "non-API stable" code as a plug-in analysis of a static analyzer of Julia in the very near future. I'll let you know. |
@aviatesk appreciate your response and the potential for frustration if you can't make these kinds of changes. Let's see what Stefan/Jeff say. JET.jl looks very interesting, I'll definitely keep an eye on it! |
We could just add back the original names that call the new ones together with a comment saying that they are for backwards compat. Similar things have been done many times before. |
@tkluck So let me show off how we can detect those "unstable API"s automatically by a plug-in analysis of JET. Here is the analysis result against IRTools@v0.4.3, and it correctly detects # ... the definition of UnstableAPIAnalyzer here
julia> is_irtools(mod) = occursin("IRTools", string(Symbol(mod)))
julia> report_package("IRTools"; analyzer=UnstableAPIAnalyzer, is_target_module=is_irtools)
═════ 59 possible errors found ═════
┌ @ /Users/aviatesk/.julia/packages/IRTools/aSVI5/src/reflection/reflection.jl:39 Core.kwfunc(IRTools.Inner.invoke_meta)(Core.apply_type(Core.NamedTuple, (:world,))(Core.tuple(world)), IRTools.Inner.invoke_meta, T)
│┌ @ /Users/aviatesk/.julia/packages/IRTools/aSVI5/src/reflection/reflection.jl:69 IRTools.Inner.#invoke_meta#6(world, _3, T)
││┌ @ /Users/aviatesk/.julia/packages/IRTools/aSVI5/src/reflection/reflection.jl:74 Core.kwfunc(IRTools.Inner.meta)(Core.apply_type(Core.NamedTuple, (:types, :world))(Core.tuple(S, world)), IRTools.Inner.meta, T)
│││┌ @ /Users/aviatesk/.julia/packages/IRTools/aSVI5/src/reflection/reflection.jl:38 IRTools.Inner.#meta#1(types, world, _3, T)
││││┌ @ /Users/aviatesk/.julia/packages/IRTools/aSVI5/src/reflection/reflection.jl:43 Base._methods_by_ftype
│││││ Base._methods_by_ftype is unstable !: Base._methods_by_ftype
││││└─────────────────────────────────────────────────────────────────────────────────
││││┌ @ /Users/aviatesk/.julia/packages/IRTools/aSVI5/src/reflection/reflection.jl:49 Base.isgenerated
│││││ variable Base.isgenerated is not defined: Base.isgenerated
││││└─────────────────────────────────────────────────────────────────────────────────
││││┌ @ /Users/aviatesk/.julia/packages/IRTools/aSVI5/src/reflection/reflection.jl:49 Base.uncompressed_ast
│││││ Base.uncompressed_ast is unstable !: Base.uncompressed_ast
││││└─────────────────────────────────────────────────────────────────────────────────
││││┌ @ /Users/aviatesk/.julia/packages/IRTools/aSVI5/src/reflection/reflection.jl:54
... # many other "unstable API"s detected You can have a look at JET.jl's documentation for more details or even try to run it yourself by checking out to the latest master of JET.jl. Please note that the framework is very experimental at this point and not well documented (so it's not even tagged yet). |
@aviatesk very cool! When it gets stable I'll be very happy to add it to the CI for all my packages. |
No description provided.