Shortcut for using X: X, ...
#52380
mkitti
started this conversation in
RFC: features for discussion
Replies: 1 comment 1 reply
-
How devastating would it be if julia> using LinearAlgebra: norm
julia> norm([1])
1.0
julia> LinearAlgebra.norm([1])
ERROR: UndefVarError: `LinearAlgebra` not defined I.e., that I can julia> parentmodule(norm).eigvals([1;;])
1-element Vector{Float64}:
1.0 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In code for a library with many dependencies, it is advantageous to explicitly declare from where all symbols are being added to the local namespace. This helps to avoid ambiguity issues when multiple packages export the same symbol. For example, a number of packages (e.g. Plots.jl, GR.jl, Makie.jl) export the symbol
plot
.Currently, if one wanted to just load a package and other symbols, including the package name itself, a Julia programmer has to repeat the package name as follows.
Alternatively, they could use the
import statement
together withusing
. Again, this results in repetition.To make it easier to import the package as a symbol as well as other symbols within the package, I propose we allow
.
to be a shortcut for the package as follows.Currently the first line results in a syntax error.
Beta Was this translation helpful? Give feedback.
All reactions