JuliaArrays / StaticArrays.jl

Statically sized arrays for Julia
Other
752 stars 148 forks source link

Avoid piracy #1248

Open aplavin opened 4 months ago

aplavin commented 4 months ago

StaticArrays does some piracy, at least in similar(): https://github.com/JuliaArrays/StaticArrays.jl/blob/07c12450d1b3481dda4b503564ae4a5cb4e27ce4/src/abstractarray.jl#L141-L146 Here,

HeterogeneousShapeTuple = Tuple{Vararg{Union{Integer, Base.OneTo, SOneTo} }} 

and it fits eg Tuple{}, Tuple{Int}, Tuple{Int, Int}.

It's generally a good thing to avoid piracy in foundational packages. Maybe, also related to ambiguities like https://github.com/JuliaArrays/StructArrays.jl/issues/279?..

jishnub commented 4 months ago

Strictly speaking, this isn't piracy, as the narrower method is defined in Base. It would be good to remove this, though, if possible

mateuszbaran commented 4 months ago

It would be great if we actually had non-ambiguous documentation about what is and what isn't type piracy so that we can be sure what is and what is not wrong, ref. https://github.com/JuliaLang/julia/issues/51669 . Currently there seems to be no consensus nor clear communication from core Julia devs regarding this "wider union" case.