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: a07f3367d7,66fae8c862b81b17 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Received: by 10.224.111.140 with SMTP id s12mr3064331qap.5.1351979848421; Sat, 03 Nov 2012 14:57:28 -0700 (PDT) Received: by 10.52.76.136 with SMTP id k8mr906041vdw.13.1351979848396; Sat, 03 Nov 2012 14:57:28 -0700 (PDT) Path: gf5ni18188417qab.0!nntp.google.com!c7no5159459qap.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 3 Nov 2012 14:57:28 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=46.171.80.166; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S NNTP-Posting-Host: 46.171.80.166 References: <1aWdnbcg_8-BzAzNnZ2dnUVZ_j6dnZ2d@giganews.com> <559eb706-9bb1-496d-9034-1984d693531a@googlegroups.com> <5460fdc7-5490-4889-b771-67cc281c10c5@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <6260a796-83c4-4ce5-88cb-8249846bc035@googlegroups.com> Subject: Re: Copy vector in Ada From: Maciej Sobczak Injection-Date: Sat, 03 Nov 2012 21:57:28 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Date: 2012-11-03T14:57:28-07:00 List-Id: W dniu sobota, 3 listopada 2012 17:03:33 UTC+1 u=C5=BCytkownik Hibou57 (Yan= nick Duch=C3=AAne) napisa=C5=82: > Some other words: I hardly believe an assignment operator could ever be O= K =20 > within a context where the meaning of what an object is depends on whethe= r =20 > it is used by value or reference (the truncation case Peter made me =20 > recall), and where there's nothing like proper class wide type, as C++ = =20 > class wide behaviour also depends on whether an instance is used by value= =20 > vs by reference (always class wide with reference). Can you make an =20 > assignment operator works fine and uniformly in such circumstances? No and I don't even intend to do it. Mixing assignment with polymorphism is= evil and cannot be implemented reasonably anyway. In the case of derivatio= n hierarchy I would rather introduce the "clone" operation or something equ= ivalent. Interestingly, in the hierarchy I would also ban the copying entir= ely, which means that pass by copy becomes impossible and the whole problem= of uniformity just disappears. Note that Ada does not provide any universal solution to this problem, eith= er - assignment cannot be reasonably implemented apart from the case of mat= ching tags, which introduces a run-time aspect to the whole; this is in con= trast to banning assignment, which in terms of limitedness is always resolv= ed statically. It's a bit messy. > The > orthogonality C++ lacks here is a fact to be added to the particular poin= t =20 > you raised. Not much. In the case of derivation hierarchy, neither Ada nor C++ offer an= ything useful (and that's OK as the concept is broken anyway). C++ does pro= vide a cleaner solution for the case of non-dispatching assignment. --=20 Maciej Sobczak * http://www.msobczak.com * http://www.inspirel.com