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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-24 05:46:37 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!yellow.newsread.com!netaxs.com!newsread.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Is the Writing on the Wall for Ada? Date: Wed, 24 Sep 2003 14:55:03 +0200 Message-ID: References: <568ede3c.0309160929.1d0d3d95@posting.google.com> <3F67AFB9.7040001@attbi.com> <3F6F0841.60607@attbi.com> <1064244399.683441@master.nyc.kbcfp.com> NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1064407595 5469256 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:42852 Date: 2003-09-24T14:55:03+02:00 List-Id: On Wed, 24 Sep 2003 11:43:08 GMT, Matthew Heaney wrote: >Dmitry A. Kazakov writes: > >> T_Set and NT_Set are unrelated types. So one cannot be a >> subtype/subclass of another. It means that I cannot write a >> NON-GENERIC program operating on both. > >Your problem was to have an operation to traverse a container of >Element_Type, and to be able to reuse the same operation over a >container whose element type derives from Element_Type. > >The solution I showed does that. Whether it's generic vs. non-generic >shouldn't matter. It matters, because generics cannot be put into a library, because they need to be instantiated. The solution is unhandy and too complex. What I need is a quite simple and understandable thing. I want to take a container type and put a constraint on it. In terms of discriminants: -- This is not Ada! type Container (Element_Tag : T_Set'Class'Tag) is ...; subtype Specialized_Container is Container (NT_Set'Class'Tag); --- Regards, Dmitry Kazakov www.dmitry-kazakov.de