Re: 7.0 wishlist?



Joshua Cranmer <Pidgeot18@xxxxxxxxxxxxxxx> wrote:
Andreas Leitgeb wrote:
Joshua Cranmer <Pidgeot18@xxxxxxxxxxxxxxx> wrote:
The idea that changing the height does not change the width is what is
violated.
And that is, what I consider an #1 example of a goofy contract.
Well, first off, the entire example is contrived.
That point taken.

But in any case, most people would agree, on only seeing the Rectangle
class, that assertContract should always succeed

I'm seemingly not "most people". I'd think about fix-proportioned
rectangles, where changing the width would auto-adjust the height
and vice versa. I have seen applications that behaved that way:
you grew/shrunk it in height, and it grew/shrunk in width proportionally.
And it made sense for these.

The point still remains, though, that structures from mathematics are
not directly transferable to code.

That point not taken. The only reason why a Square would not be a
Rectangle (in Java) would be a goofy contract attached to the Rectangle.
Imho, this is an entirely different pair of shoes than whether
commutativity is broken by side-effects of the operands.

Anyway, (to return one level back in the discussion), demanding
that (intValue + SomeClassInstance) could always be rewritten to
(SomeClassInstance + intValue) is goofy, too, not withstanding the
goofiness of actually writing such unreadable code that would
exhibit such side effects for the operands.

.