ole/Ampere

Some relations not expressible due to conflicts

ole opened this issue · 0 comments

ole commented

This currently produces an error because UnitForce already conforms to UnitProduct for force = mass × acceleration and we cannot add another conformance to the same protocol:

/// Pressure = Force / Area ⇔ Force = Pressure * Area
/// 1 Pa = 1 N / 1 m²
extension UnitForce: UnitProduct {
    public typealias Factor1 = UnitPressure
    public typealias Factor2 = UnitArea
    public typealias Product = UnitForce

    public static func defaultUnitMapping() -> (Factor1, Factor2, Product) {
        return (.newtonsPerMetersSquared, .squareMeters, .newtons)
    }
}

Is it necessary to introduce another protocol (like UnitRatio) for this?