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-Thread: 103376,2ff5c149712ec0eb X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!proxad.net!u-picardie.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Ada Interfaces and the Liskov Substitution Principle Date: Thu, 24 May 2007 17:58:23 -0500 Organization: Jacob's private Usenet server Message-ID: References: <1179953657.839272.160320@a26g2000pre.googlegroups.com> <1179991769.376381.252010@m36g2000hse.googlegroups.com> <12h6mi42jcha0.7f9vfsnihjwr$.dlg@40tude.net> <1180011507.159515.46920@o5g2000hsb.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1180047383 8461 69.95.181.76 (24 May 2007 22:56:23 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 24 May 2007 22:56:23 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 Xref: g2news1.google.com comp.lang.ada:15925 Date: 2007-05-24T17:58:23-05:00 List-Id: "Maciej Sobczak" wrote in message news:1180011507.159515.46920@o5g2000hsb.googlegroups.com... ... > I was talking about real assignment - and this assumes that two > objects already exist and we make one to be equal to the other. There > is no way to do it right. (Using the *correct* terminology as Bob noted) Given the current Ada rules, what classwide assignment is good for is *re*construction: procedure Do_Something(Y : out Object'Class) is begin Y := Constructor_Func (); end Do_Something; that is, the replacement of an object with different one of the same type. The Constructor_Func is dispatching on the real type of the LHS object, so the new object will be constructed with the proper attributes of that type. Admittedly, this is not a common need, although I think I used it once in the Claw builder to change properties on the fly that Claw doesn't support changing on the fly. (Ultimately, though, we changed Claw to be more flexible.) Randy.