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

Excessive using statements in Sort.jl #45654

Closed
LilithHafner opened this issue Jun 12, 2022 · 7 comments
Closed

Excessive using statements in Sort.jl #45654

LilithHafner opened this issue Jun 12, 2022 · 7 comments
Labels
sorting Put things in order

Comments

@LilithHafner
Copy link
Member

This smells bad:

import ..@__MODULE__, ..parentmodule
const Base = parentmodule(@__MODULE__)
using .Base.Order
using .Base: copymutable, LinearIndices, length, (:), iterate, elsize,
    eachindex, axes, first, last, similar, zip, OrdinalRange, firstindex, lastindex,
    AbstractVector, @inbounds, AbstractRange, @eval, @inline, Vector, @noinline,
    AbstractMatrix, AbstractUnitRange, isless, identity, eltype, >, <, <=, >=, |, +, -, *, !,
    extrema, sub_with_overflow, add_with_overflow, oneunit, div, getindex, setindex!,
    length, resize!, fill, Missing, require_one_based_indexing, keytype, UnitRange,
    min, max, reinterpret, signed, unsigned, Signed, Unsigned, typemin, xor, Type, BitSigned

using .Base: >>>, !==

There are two many symbols to read.
What's special about >>> and !==?
length is listed twice.
Are all these really used? Probably not.
Roughly all but 4 of these 62 symbols are imported automatical by using Base

@N5N3
Copy link
Member

N5N3 commented Jun 12, 2022

But Core.Compiler exports none of them?

@LilithHafner
Copy link
Member Author

LilithHafner commented Jun 12, 2022

I don't think Core.Compiler exports any of them, because when I type using Core.Compiler and then try first I don't get "WARNING: both Core.Compiler and Base export "first"; uses of it in module Main must be qualified"

@N5N3

This comment was marked as resolved.

@LilithHafner
Copy link
Member Author

I think we are in agreement, I edited my reply to try to clarify that.

@N5N3
Copy link
Member

N5N3 commented Jun 12, 2022

Opps, my fault.

But Core.Compiler exports none of them?

What I mean is

julia> Core.Compiler.Sort.Base
Core.Compiler

julia> Base.Sort.Base
Base

And the long list above seems unavoidable? (Of course we can remove repetitive/unnecessary using )

@LilithHafner
Copy link
Member Author

And the long list above seems unavoidable?

I'm also not sure how to avoid it

Of course we can remove repetitive/unnecessary using

I slip that into #45222

@JeffBezanson
Copy link
Member

Yes, this weirdness is due to Sort being included in both Base and Core.Compiler. We might be able to remove all or most of it in the future with better separate compilation support. Removing the duplicates is of course welcome. Other than that I will close this since it's not a significant problem and it will be a while before we can really address it.

@LilithHafner LilithHafner added the sorting Put things in order label Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sorting Put things in order
Projects
None yet
Development

No branches or pull requests

3 participants