JuliaArrays / JuliaArrays/StaticArrays.jl
Deprecation of `ones(::AbstractVector)`
Open
Nobody has claimed this yet.
cleanup
feature
- Dominant language
- Julia
- Stars
- 844
- Forks
- 159
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 3
Description
This is a somewhat ugly mess:
julia> ones(@SMatrix [0;])
┌ Warning: `ones(A::StaticArray)` is deprecated, use `ones(typeof(A))` instead.
│ caller = top-level scope at none:0
└ @ Core none:0
1×1 SArray{Tuple{1,1},Int64,2,1}:
1
julia> ones([0;])
┌ Warning: `ones(a::AbstractArray)` is deprecated, consider `fill(1, size(a))`, `fill!(copy(a), 1)`, or `fill!(similar(a), 1)`. Where necessary, use `fill!(similar(a), one(eltype(a)))`.
│ caller = top-level scope at none:0
└ @ Core none:0
1-element Array{Int64,1}:
1
But now
julia> ones(typeof(@SMatrix [0;]))
1×1 SArray{Tuple{1,1},Int64,2,1}:
1
julia> ones(Int)
0-dimensional Array{Int64,0}:
1
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
Reproduce the two ones examples from the issue and compare the deprecated calls with ones(typeof(A)) and ones(Int). Trace the relevant ones methods in StaticArrays.jl and Julia, then establish the intended deprecation behavior and verify that the resulting outputs and warnings are consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100