Re: Redefine to make a contract stronger (Was: is_equal ofHASHABLE)
Roger Browne <[email protected]>
| Newsgroups | gmane.comp.lang.eiffel.smalleiffel |
|---|---|
| Message-ID | <1116364613.13508.3.camel@eden> |
Frank Boehme wrote:
> ... I have a general relation class (lets call it R) and a number
> of more specified ones that inherit from R (conforming). These are
> REFL_R (reflexive relations), IRR_R (irreflexive), SYM_R (symmetric),
> ANTSYM_R (antisymmetric) and TRANS_R (transive relations) to name but a
> few. All these classes do not change anything but adding postconditions
> to already existing features from R which provide concatanation,
> reversion etc. Of course, it is very common to inherit from more than
> one of these ... I do not want to have any of these
> classes deferred ...
> Now, it might be a little counterintuitive to have something like
>
> class LESS_THAN
> inherit
> IRR_R undefine .... end
> ANTSYM_R undefine .... end
> TRANS_R
> ...
>
> It does not matter which of the parents has no 'undefine' but there must
> be exactly one. A little odd, given the fact that LESS_THAN *is*
> irreflexive, antisymmetric and transitive and all of these three
> properties are equally significant.
You could presumably keep the symmetry by doing it like this:
class LESS_THAN
inherit
IRR_R undefine .... end -- property
ANTSYM_R undefine .... end -- property
TRANS_R undefine .... end -- property
R -- implementation
...
> No no, I strongly advocate the new keyword 'recontract'! We do need
> this! :-))
A better keyword might be "renegotiate"?
Regards,
--
Roger Browne <[email protected]>