JuliaDiff / JuliaDiff/BlueStyle
The `README.md` is unclear about imports
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 519
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Description
This part of the README
My problem
I don't understand how using is more explicit and clearer than import.
Consider this example:
Imagine this code is part of some bigger library and somebody forgot to add the prefix LinearAlgebra to eigvals, which I believe is the intended style because then the namespace is clear.
julia> import LinearAlgebra
x = [1 0 0; 0 1 0; 0 0 1]
print(eigvals(x))
ERROR: UndefVarError: eigvals not defined
We get a nice error, because eigvals is not in our namespace. However, this code is not following the Blue style guide because of
Prefer the use of
usingoverimportto ensure that extension of a function is always explicit and on purpose
Writing this using the blue style guide we don't get an error, so mistakes like this can easily go unnoticed.
julia> using LinearAlgebra
x = [1 0 0; 0 1 0; 0 0 1]
print(eigvals(x))
[1.0, 1.0, 1.0]
also,
Note: Prefer the use of imports with explicit declarations when writing packages.
what imports, imports as in import or imports in general? An example would make it clearer.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the README.md section shown in the issue and compare its guidance on using, import, and explicit declarations. Clarify the distinction with a concrete example that explains the intended package and library usage; done means a newcomer can understand when each form is recommended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100