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!o5g2000hsb.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Ada Interfaces and the Liskov Substitution Principle Date: 29 May 2007 01:03:23 -0700 Organization: http://groups.google.com Message-ID: <1180425803.422075.100090@o5g2000hsb.googlegroups.com> References: <1179953657.839272.160320@a26g2000pre.googlegroups.com> <1179991769.376381.252010@m36g2000hse.googlegroups.com> <12h6mi42jcha0.7f9vfsnihjwr$.dlg@40tude.net> <1180011507.159515.46920@o5g2000hsb.googlegroups.com> <1180079541.558215.256570@h2g2000hsg.googlegroups.com> <1180124867.710641.176330@k79g2000hse.googlegroups.com> <1k165n4jwxna3$.1mpx49xvcrc0z$.dlg@40tude.net> <1180254636.632499.3340@o5g2000hsb.googlegroups.com> <1p717twnydnre$.1j6izygvqo832.dlg@40tude.net> NNTP-Posting-Host: 137.138.37.241 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1180425806 7715 127.0.0.1 (29 May 2007 08:03:26 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 29 May 2007 08:03:26 +0000 (UTC) In-Reply-To: <1p717twnydnre$.1j6izygvqo832.dlg@40tude.net> 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: o5g2000hsb.googlegroups.com; posting-host=137.138.37.241; posting-account=Ch8E9Q0AAAA7lJxCsphg7hBNIsMsP4AE Xref: g2news1.google.com comp.lang.ada:15960 Date: 2007-05-29T01:03:23-07:00 List-Id: On 27 Maj, 12:04, "Dmitry A. Kazakov" wrote: > To ban something in the language you have to translate the ban into > language terms. That could be either by syntax or by semantic rules. > Because syntactically banned assignments are indistinguishable from legal > ones, the only mechanics you could use for this is matching types. The > types in question are from the same hierarchy (covariant). This lets mixing > such types. So it *must* be contravariant to be banned = the operation > (":=") will not be inherited in the argument of interest upon inheritance. OK, now I see your point. I have nothing against following this path - assignment statement *is* special anyway. What could go wrong if we say that assignment is not inherited? > And I don't see why it is a mess. What is wrong in assignment of > UTF8_String to Wide_String, both from String'Class? Probably design issue. Character encoding can/should be a strategy inside a String, you don't need to subclass the whole thing just for it. There are many aspects on which you could parameterize String and with some of them being orthogonal you could quickly end up with milion leaf classes. > The very definition of a class says that types there share class-wide and > primitive operations. If that is not the case: ":=" is not shared, then > either it is not a class (= don't derive! if need not) or there is no ":=" > (= make it limited! if unsure). Looks much like a design problem. Yes. That's why I say that I have never seen any reasonable hierarchy that supports assignments. > There is nothing special in > assignments. Yes, there is - they are generated. This is deceptive, because it makes one think that it should all work by magic. Another reason why they are special is that they are intuitively associated with some particular effects and these effects cannot be reasonably provided in an automated way. That's why I think that assignments of class-wide types should be forbidden. -- Maciej Sobczak http://www.msobczak.com/