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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC 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,ASCII Received: by 10.180.96.6 with SMTP id do6mr5285905wib.1.1352353208206; Wed, 07 Nov 2012 21:40:08 -0800 (PST) From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Copy vector in Ada Date: Mon, 5 Nov 2012 09:31:41 +0100 Organization: cbb software GmbH Message-ID: References: <1aWdnbcg_8-BzAzNnZ2dnUVZ_j6dnZ2d@giganews.com> <559eb706-9bb1-496d-9034-1984d693531a@googlegroups.com> <5460fdc7-5490-4889-b771-67cc281c10c5@googlegroups.com> <6260a796-83c4-4ce5-88cb-8249846bc035@googlegroups.com> <10y91ckm54l57$.8u8bbq342u1b.dlg@40tude.net> <2164bc1a-a841-46ed-bfef-4ddcae4d64f7@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: FbOMkhMtVLVmu7IwBnt1tw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Path: ha8ni167505wib.1!nntp.google.com!feeder3.cambriumusenet.nl!feeder1.cambriumusenet.nl!feed.tweaknews.nl!209.197.12.242.MISMATCH!nx01.iad01.newshosting.com!newshosting.com!216.196.98.146.MISMATCH!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.mccarragher.com!news.grnet.gr!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!aioe.org!.POSTED!not-for-mail Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 8bit Date: 2012-11-05T09:31:41+01:00 List-Id: On Sun, 4 Nov 2012 12:49:13 -0800 (PST), Maciej Sobczak wrote: > W dniu niedziela, 4 listopada 2012 08:25:11 UTC+1 u�ytkownik Dmitry A. Kazakov napisa�: > >>> No and I don't even intend to do it. Mixing assignment with polymorphism >>> is evil and cannot be implemented reasonably anyway. >> >> How so? Assignment is clearly a polymorphic operation. > > It is not "clearly" to me. Assigning Rectangles to Triangles does not make any sense. Does the example presume that both are in the same hierarchy of types, e.g. "shape"? Whether assignment makes sense depends on that. >>> either - assignment cannot be reasonably implemented apart from the case >>> of matching tags, >> >> You mean an implementation generated by the compiler? In such cases the >> programmer must be required to override. > > I also mean what the programmer might possibly provide - Rectanges vs. Triangles and so on. He will replace a triangular shape with a rectangular one. >>> (and that's OK as the concept is broken anyway). >> >> Concept of what? In C++ you can assign int to double. > > No, you cannot. You can assign double to double and there is an implicit > conversion from int to double. This is an implementation detail. > Both are also numbers with quite > straightforward interpretation so these tricks are meaningful. This is > nowhere similar to Rectangles vs. Triangles and stuff. Both are straightforward geometric shapes. It is not the language business to judge about the problem space. >> In Ada you can assign Positive to Integer. > > It is the same type. They are NOT *semantically* same: X : Positive := -1; Y : Integer := -1; >> Is this broken? > > Rectangles vs. Triangles is broken. What is broken? You make some assumptions about the semantics of assignment, which may or may not hold. Again, it is not the language business. [*] It is all up to programmer to decide if he wanted assignment defined on {Rectangle, Triangle}**2. Depending on that, he will chose an appropriate mapping of the desired semantics onto the language types. In this order. -------------------- * FSA, type systems etc are far too weak to capture complex structures like real numbers or geometric shapes. This is why the programmer always knows better. There cannot be a universal computer model of either. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de