Skip to content
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

Some relations not expressible due to conflicts #5

Open
ole opened this issue Sep 10, 2016 · 0 comments
Open

Some relations not expressible due to conflicts #5

ole opened this issue Sep 10, 2016 · 0 comments

Comments

@ole
Copy link
Owner

ole commented Sep 10, 2016

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant