You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.
I noticed the following unfortunate behaviour. Point2 does not specify it's precision but defaults to Float64.
However when calling rand(Point2, 2) we receive an array that is not concretely typed.
From what I see, this is not really an issue with GeometryTypes.jl, but the underlying StaticArrays.jl that is used for the points.
I tracked this down to
@generated function _rand(rng::AbstractRNG, ::Size{s}, ::Type{SA}) where {s, SA <: StaticArray}
T = eltype(SA)
if T == Any
T = Float64
end
v = [:(rand(rng, $T)) for i = 1:prod(s)]
return quote
@_inline_meta
$SA(tuple($(v...)))
end
end
which is in arraymath.jl of StaticArrays.
Though I don't really think this is even a real defect there, because as result it gives you an Array that you can still push more static arrays with other inner types to, and when you really want just Float64, you can still give it explicitly.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I noticed the following unfortunate behaviour.
Point2
does not specify it's precision but defaults to Float64.However when calling
rand(Point2, 2)
we receive an array that is not concretely typed.The text was updated successfully, but these errors were encountered: