The type Graphic2D is a specialization of type Graphic that adds methods for interrogating the size of, and resizing, the object. This is not apparent from the names.
Worse, there is no type that represents a Graphic with a size. Class
drawable2DAt (location': Point)
size (dimension': Point)
on (canvas': DrawingCanvas)
claimed that it generated a Graphic2D, when it actually generates a
Graphic & interface {
width -> Number
height -> Number
size -> Point
}
When the compiler started generating a check for the return types, it failed. Commit f0e8b71 corrects the code.
However, errors like this are easy to make with such non-mnemonic names. I suggest either that all Graphics have a size, or, if this is infeasible, that we use three types Graphic, SizableGraphic, and ResizableGraphic. Add the 2D suffix to all of them if you like.
The type
Graphic2Dis a specialization of typeGraphicthat adds methods for interrogating the size of, and resizing, the object. This is not apparent from the names.Worse, there is no type that represents a
Graphicwith a size. Classclaimed that it generated a
Graphic2D, when it actually generates aWhen the compiler started generating a check for the return types, it failed. Commit f0e8b71 corrects the code.
However, errors like this are easy to make with such non-mnemonic names. I suggest either that all
Graphics have asize, or, if this is infeasible, that we use three typesGraphic,SizableGraphic, andResizableGraphic. Add the2Dsuffix to all of them if you like.