Benoit Jacob wrote:

Strawman class diagram:

     Transformation
     /      |      \
    /       |       \
   /        |        \
  /         |         \
Identity   Matrix    Other transform types
                      e.g. Translation
In such a world, the class containing the word "Matrix" in its name would not have a isIdentity() method; and for use cases where having a "variant type" that can avoid being a full blown matrix is meaningful, we would have such a variant type, like "Transformation" in the above diagram, and the isIdentity() method there would be merely asking the variant type for its type field.

I think roc suggested the possibility of something similar i.e.

       Transformation
       /      |      \
      /       |       \
     /        |        \
    /         |         \
Identity   2DMatrix   3DMatrix

Then from JS you would just write (matrix instanceof Identity). I don't know whether this would make the implementation unduly complex though.

--
Warning: May contain traces of nuts.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to