Keno / SIUnits.jl

Efficient unit-checked computation
Other
70 stars 26 forks source link

Multiplication of array by an SIUnit results in an unspecified SI type #25

Open mbauman opened 10 years ago

mbauman commented 10 years ago

Is there any way we could get better typing here?

 julia> typeof([1s,2s,3s])
 Array{SIQuantity{Int64,0,0,1,0,0,0,0},1}

 julia> typeof([1,2,3]s)
 Array{SIQuantity{Int64,m,kg,s,A,K,mol,cd},1}

I think I understand that we don't know whether we're multiplying or dividing in the promotion system, so we cannot tell what the promotion result should be if there are two unitful quantities. It feels like we should be able to determine this, especially when one argument is not an SI type… but I guess you still don't know whether to multiply or divide.

Are there any workarounds to creating a better-typed SI array when you already have a plain array of non-SI data?