Xref: utzoo comp.lang.eiffel:1432 comp.object:2608 Path: utzoo!attcan!uunet!mcsun!hp4nl!kubix!weigand From: weigand@kub.nl (Hans Weigand) Newsgroups: comp.lang.eiffel,comp.object Subject: Re: Inheritance and Information Hiding Summary: Preconditions are necessary, not sufficient conditions Keywords: preconditions, inheritance Message-ID: <1991Feb11.112414.9348@kub.nl> Date: 11 Feb 91 11:24:14 GMT References: <27A86309.281A@tct.uucp> <1991Feb5.130359.9735@bellcore.bellcore.com> <494@eiffel.UUCP> Organization: Tilburg University, The Netherlands Lines: 33 In article <494@eiffel.UUCP> bertrand@eiffel.UUCP (Bertrand Meyer) writes: >... >This does not work, since the new precondition would be stronger (again, >see above references). It would make it impossible for a client Perhaps the problem discussed here hinges on an inappropriate definition of the precondition. Usually, preconditions are thought to be *nessecary* conditions, and, moreover, the implicit assumption is that when all necessary conditions have been specified, these together are also sufficient. In this conception, preconditions can be inherited and strenghtened for subtypes. However, if a precondition is assumed to be sufficient, as Eiffel does, rather than necessary, then the inheritance runs counter to the usual line of specification. That is, the programmer first specifies the supertype, and specifies the preconditions that he deems necessary. However, when he later comes to subtypes, he typically wants to add more specific preconditions. In the "sufficiency" approach, the programmer should be aware of all subtypes details when he is designing the supertype, which is not reasonable. Perhaps you say that the "sufficiency" approach follows from the contract view, but I doubt. When I make a contract for X, and state my conditions (the obligations of the client), I do not commit myself more than needed. If the client wants to use my product Y too (the subtype), then I would like to be able to negotiate new conditions. These conditions then add to the first ones. Reference: Wieringa R, H Weigand, JJ Meyer, F Dignum: The Inheritance of Dynamic and Deontic Integrity Constraints. Annals of Mathematics and Artificial Intelligence, Nov 1990. -- Hans Weigand Tilburg University Brought to you by Super Global Mega Corp .com