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!h2g2000hsg.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Ada Interfaces and the Liskov Substitution Principle Date: Fri, 01 Jun 2007 06:32:30 -0700 Organization: http://groups.google.com Message-ID: <1180704750.516171.126220@h2g2000hsg.googlegroups.com> References: <1180124867.710641.176330@k79g2000hse.googlegroups.com> <1k165n4jwxna3$.1mpx49xvcrc0z$.dlg@40tude.net> <1180254636.632499.3340@o5g2000hsb.googlegroups.com> <1p717twnydnre$.1j6izygvqo832.dlg@40tude.net> <1180425803.422075.100090@o5g2000hsb.googlegroups.com> <1180452858.118039.67740@w5g2000hsg.googlegroups.com> <1180510814.812025.251580@u30g2000hsc.googlegroups.com> <1180529642.741098.224230@q66g2000hsg.googlegroups.com> <1ljmbgesxien.syhurcvjdcd2$.dlg@40tude.net> <1180558336.041236.211560@p77g2000hsh.googlegroups.com> <1j91i6rk18kqd.4zjp36eyvps3.dlg@40tude.net> <1180619211.595952.116690@k79g2000hse.googlegroups.com> NNTP-Posting-Host: 137.138.37.241 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1180704750 18880 127.0.0.1 (1 Jun 2007 13:32:30 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 1 Jun 2007 13:32:30 +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: h2g2000hsg.googlegroups.com; posting-host=137.138.37.241; posting-account=Ch8E9Q0AAAA7lJxCsphg7hBNIsMsP4AE Xref: g2news1.google.com comp.lang.ada:16027 Date: 2007-06-01T06:32:30-07:00 List-Id: On 1 Cze, 09:29, "Dmitry A. Kazakov" wrote: > You are trying to invent some alternative meaning for class-wide. Not really. There is a difference between this: X : T'Class := Y; and this: X := Y; -- with X, Y : T'Class; The difference is coming from the fact that T'Class gets bound at initialization only and cannot change its binding (tag for you) later on (X cannot change the actual type). In other words, X can become equivalent to Y by initialization, but not by assignment. The latter is already too late - you might be assigning Triangles to Circles. This is what makes T'Class different from T. Of course, you can say that the meaning of assignment and equivalence are both user-defined and can go together, but this way of thinking usually subverts the regular meaning of :=. Not the Ada way. > > You don't need to assign it. It is enough if you can replace it. > > Care to explain difference? You can replace a Circle with a Triangle but you better not try to assign them. Note that you normally replace a Circle with a Triangle by *assignments* of references of the appropriate interface type. ;-) This indirection solves the problem, because references (pointers) themselves are values. No, hierarchies and values don't go together. I might lack the formalism to prove it, but my observations are confirming: I've never seen it in the wild. -- Maciej Sobczak http://www.msobczak.com/