Skip to content
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

use === instead of == to compare Symbols #4622

Merged
merged 1 commit into from
Jan 6, 2023

Conversation

ranocha
Copy link
Contributor

@ranocha ranocha commented Jan 6, 2023

I found invalidations from loading both RecipesBase.jl and SciMLBase.jl using the beta of Julia 1.9:

julia> using Pkg; Pkg.activate(temp=true); Pkg.add("SciMLBase"); Pkg.develop("RecipesBase")

julia> using SnoopCompileCore; invalidations = @snoopr(using RecipesBase, SciMLBase); using SnoopCompile

julia> trees = invalidation_trees(invalidations)
[...]
 inserting ==(retcode::SciMLBase.ReturnCode.T, s::Symbol) @ SciMLBase ~/.julia/packages/SciMLBase/QqtZA/src/retcodes.jl:348 invalidated:
   backedges: 1: superseding ==(x, y) @ Base Base.jl:127 with MethodInstance for ==(::Any, ::Symbol) (12 children)

I fixed invalidations by using === instead of == when comparing to a Symbol, which is also recommended in the docstring of Symbol:

help?> Symbol
search: Symbol
[...]
  Symbols are immutable and should be compared using ===. The implementation re-uses the same object for all
  Symbols with the same name, so comparison tends to be efficient (it can just compare pointers).
[...]

@ranocha
Copy link
Contributor Author

ranocha commented Jan 6, 2023

CI fails with a lot of Path to conda environment is not valid errors that do not seem to be related to this PR?

@BeastyBlacksmith BeastyBlacksmith merged commit 9971a13 into JuliaPlots:master Jan 6, 2023
@BeastyBlacksmith
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants