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: 27 May 2007 01:30:36 -0700 Organization: http://groups.google.com Message-ID: <1180254636.632499.3340@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> NNTP-Posting-Host: 85.3.202.121 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1180254638 8051 127.0.0.1 (27 May 2007 08:30:38 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 27 May 2007 08:30:38 +0000 (UTC) In-Reply-To: <1k165n4jwxna3$.1mpx49xvcrc0z$.dlg@40tude.net> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.0.1) Gecko/20060317 Firefox/1.5.0.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: o5g2000hsb.googlegroups.com; posting-host=85.3.202.121; posting-account=Ch8E9Q0AAAA7lJxCsphg7hBNIsMsP4AE Xref: g2news1.google.com comp.lang.ada:15946 Date: 2007-05-27T01:30:36-07:00 List-Id: On 26 Maj, 09:48, "Dmitry A. Kazakov" wrote: > > I'm still for banning it. > > For this you have to make assignment contravariant (non-primitive > operation) in one of its arguments. That would be a total mess, because it > would require overloading assignment for each derived type. I don't get it. I said I would ban it. There is no "for this". :-) > For the same reason all signatures with a class-wide parameter are bad, > because they lead to ambiguities in trivial cases: > > type S is new T with ...; > X, Y : S; > > X := Y; -- S'Class x S'Class vs T'Class x T'Class? > > You will need some sort of dominance rules to resolve that. Why? Both X and Y are of the same type above and it is not a class wide type in the sense that no dispatching is needed here. In other words, the above assignment can be bound statically. > P.S. Probably you have in mind a "stratified" assignment which statically > checks that LHS and RHS are of the same type. Not necessarily. I would allow different types if the assignment_statement is overloaded for them for those who like to introduce sort of implicit conversions. What I worry about is the situation where *both* dynamic types are not known statically. This is a mess. > ----------- > * Ada's assignment is doubly dispatching. The dispatching table is a > square, the diagonal of consists of thunks: > > Finalize (LHS); > bit-copy (LHS, RHS); > Adjust (LHS); > > Non-diagonal elements are: > > raise Constraint_Error; Which is a run-time thingy. It's good if it's there, but I want stricter guarantees. You can get them by just banning assignment_statement between class-wide types. -- Maciej Sobczak http://www.msobczak.com/