Currently the function signature for fill is
|
Base.fill(x, inds::Tuple{UnitRange,Vararg{UnitRange}}) = |
|
fill!(OffsetArray{typeof(x)}(undef, inds), x) |
However the function clearly only works with integral values, as the OffsetArray constructor only accepts Ints. Something like this will fail:
julia> fill(3.0,UnitRange(3.0,5.0))
ERROR: MethodError: no method matching OffsetArray(::Array{Float64,1}, ::Tuple{Float64})
Should the types dispatched upon be constrained to UnitRange{<:Integer}? This will also allow other packages to define these methods for various other UnitRange types.
The same for other functions like zeros, ones, trues, falses.
Currently the function signature for
fillisOffsetArrays.jl/src/OffsetArrays.jl
Lines 212 to 213 in 7294f3d
However the function clearly only works with integral values, as the
OffsetArrayconstructor only acceptsInts. Something like this will fail:Should the types dispatched upon be constrained to
UnitRange{<:Integer}? This will also allow other packages to define these methods for various otherUnitRangetypes.The same for other functions like
zeros,ones,trues,falses.