-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit type computations #164
Comments
In principle I agree that such a calculation should be possible at compile time. However, it feels like a pun to define division on types, and may also count as type piracy. Jeff has signaled that overloading |
I am trying to compute the element type of an array of arrays, and the element type may be a non-concrete Quantity if the array has multiple different unit types.
No, it's not type-piracy because it would have dispatches on Quantity types only. Overloading Base.show is different and to do it is complicated and that's what's mentioned there, not anything to do with overloading other functions with Type{<:Quantity}. I think there are better precidents to looks at. You can take an julia> A = Array{Complex{Float64}}
Array{Complex{Float64},N} where N
julia> eltype(A)
Complex{Float64}
julia> real(eltype(A))
Float64 Being able to then similarly do calculations on units would allow one to build arrays before computing all of the values. |
Yes, those are better examples. I'll try it out. |
It would be nice to be able to compute on the type directly:
This would allow the computation of where types as well:
Currently, handling recursive arrays is incompatible with Unitful due to the inability to do this calculation.
The text was updated successfully, but these errors were encountered: