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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2ff5c149712ec0eb X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!m36g2000hse.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Ada Interfaces and the Liskov Substitution Principle Date: 24 May 2007 00:29:29 -0700 Organization: http://groups.google.com Message-ID: <1179991769.376381.252010@m36g2000hse.googlegroups.com> References: <1179953657.839272.160320@a26g2000pre.googlegroups.com> NNTP-Posting-Host: 137.138.37.241 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1179991776 6792 127.0.0.1 (24 May 2007 07:29:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 24 May 2007 07:29:36 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.10) Gecko/20070228 Red Hat/1.5.0.10-0.1.slc3 Firefox/1.5.0.10,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: m36g2000hse.googlegroups.com; posting-host=137.138.37.241; posting-account=Ch8E9Q0AAAA7lJxCsphg7hBNIsMsP4AE Xref: g2news1.google.com comp.lang.ada:15898 Date: 2007-05-24T00:29:29-07:00 List-Id: On 23 Maj, 23:58, "Randy Brukardt" wrote: > > My humble opinion: assignment of class-wide types should be prohibited > > in the first place. I mean - at compile time. > > It's just asking for troubles. > > That doesn't make much sense. Yes, it is a bit weird that assignment is > potentially a dispatching operation, but otherwise there is no semantic > problem with it. Can it be dispatching on both arguments? If not, how can you reasonably implement it? And even if it could, still, how can you *reasonably* implement it? Let's take a classic example with the hierarchy of geometric objects (Object, Rectlangle, Triangle, Circle, and so on) and this: procedure Do_Something(X : in Object'Class; Y : out Object'Class) is begin Y := X; -- ? end Do_Something; > (The OP having an illegal example, thus proving nothing.) The OP did not prove that Ada violates LSP, but he did point out where the problems can hide. Coming from C++, I have never seen any single example where assignment made sense with polymorphic hierarchies. Do you know any such example? Can you show it? > It might be a bit hard to use usefully, but that's no reason for banning it. C programmers can use the same logic to justify everything. ;-) -- Maciej Sobczak http://www.msobczak.com/