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: 103376,b553d2c02a2df59f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news3.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: limited types (Was: Records that could be arrays) Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1cwl2r5h594du$.1q4kglbpb2bma.dlg@40tude.net> <10ovc4gxk6wka.gttjb2v0fbcq$.dlg@40tude.net> <13yslifejxwuq.15rip8gh2aufj.dlg@40tude.net> <44031ace$0$13779$9b4e6d93@newsread4.arcor-online.net> <1i6nwodxgp1bn.voklt7nvcl1g$.dlg@40tude.net> <1141059143.617291.39980@i40g2000cwc.googlegroups.com> Date: Mon, 27 Feb 2006 21:21:08 +0100 Message-ID: <1dd53t0syyc1z.1ety6xoat1ce5$.dlg@40tude.net> NNTP-Posting-Date: 27 Feb 2006 21:20:55 MET NNTP-Posting-Host: a7b4b5fd.newsread2.arcor-online.net X-Trace: DXC=aL7]5[E`4Oe?m49DcKk?RnQ5U85hF6f;djW\KbG]kaMhQc4L4[MA2T`f99@0We4mDi[6LHn;2LCVn[ On 27 Feb 2006 08:52:23 -0800, Matthew Heaney wrote: > Dmitry A. Kazakov wrote: >> >> 1. Passing as a parameter > > Just pass a cursor: I don't see how a constraint imposed on elements can propagate to the cursor. The question Georg asked was: where typed containers of elements of related types might themselves appear related. The number of cases is huge. Generics fundamentally cannot help here, they aren't dynamically polymorphic. Whatever you do, the polymorphism can come only from outside, like in the case of a tagged formal parameter, or as a type inheritance in the declarative part of a generic package. So generics are completely irrelevant to the discussion about the design of constructors and the types system. >> 2. Copying > > while (Has_Element (C) loop > Put_Element_Somewhere (Element (C); > end loop; It is dynamic typing. The constraint check would happen at run-time. Too late. You just have tossed a stinking herring in a jug apple cider... >> 3. Merging > > You'll need to define a relational operator over your element type, but > then you can say: > > Merge (C1.First, C2.First); Same as above. I don't mix herrings and apples, because barrels and boxes never meet in the production line. But they can on a container ship. And their elements do in someone's stomach. >> 4. Slicing > > Just use a cursor pair: > > Do_Something (C1, C2); -- half-open range Huh, what about a submatrix? The main diagonal of? And, BTW, I don't do anything I want to get a new container. [...] > Do_Something (C1, C2); > Compare (C1, C2); Same as above. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de