Skip to content

don't warn on using Foo: _ as syntax for loading packages only for side-effects #58667

Open
@ericphanson

Description

@ericphanson

it would be nice if one could do

using ForwardDiff: _

That actually works and does load the module on 1.11, but it gives a warning:

WARNING: could not import ForwardDiff._ into Main

on nightly it gives a different warning:

julia> "ForwardDiff" in string.(collect(values(Base.loaded_modules)))
false

julia> using ForwardDiff: _
WARNING: Imported binding ForwardDiff._ was undeclared at import time during import to Main.

julia> "ForwardDiff" in string.(collect(values(Base.loaded_modules)))
true

but again still works.

One can do import ForwardDiff as _ but some style guides recommend only using. You can spell it using ForwardDiff: ForwardDiff as _ but the repetition isn't as nice.

Originally posted by @ericphanson in #58665 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions