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,b553d2c02a2df59f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!news.arcor.de!not-for-mail Date: Mon, 27 Feb 2006 22:40:18 +0100 From: Georg Bauhaus Organization: future apps GmbH User-Agent: Debian Thunderbird 1.0.2 (X11/20051002) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: limited types (Was: Records that could be arrays) 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> <1dd53t0syyc1z.1ety6xoat1ce5$.dlg@40tude.net> In-Reply-To: <1dd53t0syyc1z.1ety6xoat1ce5$.dlg@40tude.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <44037195$0$13798$9b4e6d93@newsread4.arcor-online.net> NNTP-Posting-Date: 27 Feb 2006 22:39:33 MET NNTP-Posting-Host: d2e4d550.newsread4.arcor-online.net X-Trace: DXC=>62MnDHAGaCl=9hLK`A7fM:ejgIfPPldDjW\KbG]kaMHQc4L4[MA2T@bc1HhIKW=IKUUng9_FXZ=C>:=P9Ihe`BH@Z?dZ]MOidE X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:3192 Date: 2006-02-27T22:39:33+01:00 List-Id: Dmitry A. Kazakov wrote: > 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. But then wouldn't you again be mixing apples and herrings? type APPLE_CONTAINER is new CONTAINER with null record; -- specializes in apples, only type HERRING_CONTAINER is new CONTAINER with null record; -- specializes in herrings, only x: access CONTAINER'class := ...; x.insert(an_apple); -- right or wrong? compile time? > 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, In fact, herrings with little pieces of apple aren't that unusual, add onions and mayonnaise and you are almost set - not everyone's taste, maybe. :-) Seriously, wouldn't type-forcing containers be in the way of composition? How do you make a vector of doughnuts with different toppings? Something like zip(doughnuts.first, toppings.first); seems reasonable to me.