3 ms·
> No, no: "If you ask me for any object that can have independent width and height, and you reject a Square, you are..." right, of course. It depends on the pro
by kqr 9y ago
> No, no: "If you ask me for any object that can have independent width and height, and you reject a Square, you are..." right, of course. It depends on the properties that define what a Rectangle and a Square are in your code.
I think you nailed an important distinction here, but maybe used the wrong words in doing so. The correct definition of a rectangle, with this interpretation, is any object that can change its width and height independently.
I'm just not sure that this is such a sensible definition of a rectangle.
In my mind, the word "rectangle" is a description of how things are in this instant, not a description of in which ways something can change in the future. The latter is a valid concept and something we need a word for, but I'm not sure "rectangle" is such a good candidate.
This also opens up for a solution to the problem:
- In the first sense, rectangle > square. A rectangle has four straight angles, and squares are rectangles where both lenghts happen to be the same.
- In the second sense, square > rectangle. Squares are things which can be scaled, and rectangles are squares which can scale each axis independently.
- PKop 9y agoI don't think the "that can change" characteristic is important here. You can declare that "for all values of width and height, w does not have to equal h" to be valid. Mutability is irrelevant.
- kqr 9y agoBut a rectangle as traditionally defined can have equal dimensions. Consider the rectangle whose width slowly grows to be longer than the height. Surely it does not skip a value because it happens to equal the height?
- PKop 9y ago"does not have to be equal" != "can't be equal". The set of all possible rectangles have w and h that can be different (or the same) values.