From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f039470e8f537101 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-08-01 01:13:07 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Non-philosophical definition of Eiffel? Date: Fri, 01 Aug 2003 09:57:43 +0200 Message-ID: References: <1059416297.548253@master.nyc.kbcfp.com> <1059486223.780998@master.nyc.kbcfp.com> <8tucivgbh5hkuicrpdeuavau8muf6a9mrh@4ax.com> <1059496557.747795@master.nyc.kbcfp.com> <1059583115.463164@master.nyc.kbcfp.com> <91nhivgoeparbpt1984prf1o09sos9f9p5@4ax.com> <1059666583.748653@master.nyc.kbcfp.com> NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1059724371 24143897 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:41121 Date: 2003-08-01T09:57:43+02:00 List-Id: On Thu, 31 Jul 2003 11:49:43 -0400, Hyman Rosen wrote: >Dmitry A. Kazakov wrote: >> No it isn't. You forgot semantics. LSP is all about semantics. > >Maybe it is to you. To me, LSP is all about programming. >I don't worry my head about pretty little semantic notions. Barbara's (+ rarely mentioned Wing) paper was called "A Behavioral Notion of Subtyping". Now tell me that behavior is not about semantics. >> This problem appears each time a derived type is >> a specialization of the base. > >In OO, derived types are supposed to be able to do >whatever their base can do, and optionally more. This is a vague narration of LSP-subtyping, not OO. There could be other notions as well. For instance, both C++, and Ada implement subtypings of other kinds. This was probably the reason why OO-people invented the term "subclassing", to stress a nasty truth that almost everything we are doing is not LSP conform. (:-)) >If you want a derived type to do less, don't make it a >(public) child of the Base. "to do" less vs. more vs. something other is again semantics. And inspect your sentence carefully, you will find that any polymorphic behaviour contradicts LSP. In fact, an ability for a callee to detect the actual type is enough to break substitutability. > The formal expression of >this in many OO languages is that the parameter types >of overriding functions are the same as their base >function parameter types. There are many ways. >Now, it is true that many people use a technique of >having a wide base interface, and then implementing >derived methods which do nothing but throw exceptions. >Contravariant parameter types could be looked at in >the same way - as if the overriding function took the >wider type, but immediately did a type test and threw >an exception if the result was not of the narrower >type. I don't happen to like this way of doing things, >because I favor static polymorphism, but for some >people, this floats their boat. You contradict yourself. If (according to LSP) a derived type is always substitutable for the base, why should it throw an exception in a contravariant parameter? It is not so, either in C++ where all arguments instead of the hidden one are contravariant, or in Ada (class-wide arguments). --- Regards, Dmitry Kazakov www.dmitry-kazakov.de