[swift-users] Changing precedence of / operator for my protocol?

Rick Mann rmann at latencyzero.com
Tue Nov 29 04:55:23 CST 2016


Working on dimensional analysis, I have some proof-of-concept code that seems to be working:

    let n1 = kilogram * meter / second * second
    ([(kg⋅m) / s]⋅s)

     let n2 = kilogram * meter / (second * second)
    [(kg⋅m) / (s⋅s)]

Note: () around unit products, [] around unit quotients.

I'd like to adjust the precedence of operator * for my Unit protocol to be higher than /. Is that possible? It wasn't at all clear to me how to do that in Swift 3, or if can even be done at all.

Thanks!


-- 
Rick Mann
rmann at latencyzero.com




More information about the swift-users mailing list