Uploaded image for project: 'Request For Comments'
  1. Request For Comments
  2. RFC-500

Standardize invert and getInverse to inverted

    XMLWordPrintable

    Details

    • Type: RFC
    • Status: Implemented
    • Resolution: Done
    • Component/s: DM
    • Labels:
      None

      Description

      geom::LinearTransform and geom::AffineTransform both use invert to return an inverted copy of the transform, which sounds like it modifies the transform in place. afw Transform and astshim Mapping use getInverted to return an inverted copy of the transform, which is clearer but a bit verbose.

      I would like to standardize all of these to inverted, which is clear and concise and matches other modern usage in our code, e.g. sphgeom.

      I would also like to rename simplify to simplified in astshim for clarity and consistency (this is not widely used and would be a very small change).

      The changes proposed would require small changes to roughly a dozen packages. I'm happy to do the work. If folks want less churn then a smaller scale version of the proposal is to switch inverse to getInverted (and simplify to getSimplified, for consistency).

        Attachments

          Issue Links

            Activity

            Hide
            krzys Krzysztof Findeisen added a comment -

            . This naming convention is recommended by the style guide anyway.

            Show
            krzys Krzysztof Findeisen added a comment - . This naming convention is recommended by the style guide anyway.
            Hide
            jbosch Jim Bosch added a comment -

            .

             

            As a (mostly) implementation note, I think it would be healthy for us to actually leave the old APIs available and mark them as deprecated, even if we update all downstream usage immediately - I'd like us to start getting practice with changing our APIs in a way that's more conducive to versioning different [groups of] packages separately.  That doesn't have to be this RFC, but I think this one is in a sweet spot of "used enough, but not too much" downstream to make it a good practice target.

            Show
            jbosch Jim Bosch added a comment - .   As a (mostly) implementation note, I think it would be healthy for us to actually leave the old APIs available and mark them as deprecated, even if we update all downstream usage immediately - I'd like us to start getting practice with changing our APIs in a way that's more conducive to versioning different [groups of]  packages separately.  That doesn't have to be this RFC, but I think this one is in a sweet spot of "used enough, but not too much" downstream to make it a good practice target.
            Hide
            price Paul Price added a comment -

            I thought our style guide would require calculateInverse, as it includes a verb which communicates to the user that the operation may not be not trivial.

            Show
            price Paul Price added a comment - I thought our style guide would require calculateInverse , as it includes a verb which communicates to the user that the operation may not be not trivial.
            Hide
            rowen Russell Owen added a comment -

            Paul Price returning an inverted transformation is trivial for afw Transform and astshim Mapping, and I believe it is also trivial for AffineTransform and LinearTransform (though Jim Bosch can correct me if not). simplify is also trivial in astshim.

            Show
            rowen Russell Owen added a comment - Paul Price returning an inverted transformation is trivial for afw Transform and astshim Mapping, and I believe it is also trivial for AffineTransform and LinearTransform (though Jim Bosch can correct me if not). simplify is also trivial in astshim.
            Hide
            jbosch Jim Bosch added a comment -

            I believe that rule only says we shouldn't use get<Noun> for something that may do a lot of work; invert is itself a verb, so it doesn't need get at all.  The rule this conforms to is relatively recent:

            https://developer.lsst.io/cpp/style.html#a-names-for-methods-that-return-new-objects-may-start-with-past-tense-verbs

            Show
            jbosch Jim Bosch added a comment - I believe that rule only says we shouldn't use get <Noun> for something that may do a lot of work; invert is itself a verb, so it doesn't need get at all.  The rule this conforms to is relatively recent: https://developer.lsst.io/cpp/style.html#a-names-for-methods-that-return-new-objects-may-start-with-past-tense-verbs
            Hide
            rowen Russell Owen added a comment -

            Adopted as stated

            Show
            rowen Russell Owen added a comment - Adopted as stated

              People

              Assignee:
              rowen Russell Owen
              Reporter:
              rowen Russell Owen
              Watchers:
              Jim Bosch, Krzysztof Findeisen, Paul Price, Russell Owen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Planned End:

                  Jenkins

                  No builds found.