Skip to content

Covariance permits illogical assignments #1

@buge

Description

@buge

Because we model only non-zero dimensions, it's currently possible to assign incompatible quantities to one another due to their type covariance:

const speed: Quantity<{length: 1, seconds: -1}> = metersPerSecond(5);
const length: Quantity<{length: 1}> = speed; // ouch

While we can't protect against this for all user-defined dimensions, we should look into making at least the built-in dimensions more robust by modeling known dimensions with exponent 0. I need to think through all the possible corner-cases though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions