Re: CLOS question



On Jul 29, 3:19 pm, Rainer Joswig <jos...@xxxxxxx> wrote:
In article <1185747319.410983.157...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Scott Burson <FSet....@xxxxxxxxx> wrote:
If D is a subclass of C, then although D may override a primary method
of C, D's method should maintain all the invariants that C's method
does.

'should'. That's a design decision.

There is nothing in CLOS that enforces or requires that.

Indeed. I was answering not the question he was asking, but the
question I thought he _should_ be asking. Wasn't that obvious?
(Actually, I spoke of a possible error in domain _analysis_ -- a stage
that logically even precedes design.)

That said -- the principle that subclasses should only strengthen
invariants, not weaken them, is fundamental to object-oriented
programming. I can't recall ever seeing a case where the principle
was violated that didn't cause problems. So it's a very very very
strong "should".

-- Scott

.