Hi,
Up until now, I have only used Unitful for basic conversion, however I would like now to use it for type checking. However, I cannot make it work.
I want ensure (with type safety) that a given variable is an array of a specific dimension (energy here).
Here is the code:
energies = zeros(3, 3)u"eV"
const EnergyQuantity = Quantity{T, dimension(u"eV"), U} where T where U
# prints true, as expected
@show 3u"eV" isa EnergyQuantity
@show 3u"J" isa EnergyQuantity
# prints true, as expected as well
@show energies isa Array{T, 2} where T
# prints false !
@show energies isa Array{EnergyQuantity, 2}
I do not understand why the last line does not work. Is it due to limitations of the type system, or am I just not understanding how this work ?
Thanks !