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-10-07 01:12:15 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!news-feed1.de1.concert.net!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: Tue, 07 Oct 2003 10:21:34 +0200 Message-ID: <85t4ovo3c1hgdipr9uf7brp8qtmn71qamh@4ax.com> References: <3F7B1076.8060106@comcast.net> <5mknnv4u96qqudrt4bd8n4t1cljp2fjlp8@4ax.com> <3F7C810E.7070100@comcast.net> <3G2dnS15r8mycOCiXTWJkA@gbronline.com> <5qWdnWQBj-AB9-KiU-KYuA@gbronline.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 1065514333 17048798 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:360 Date: 2003-10-07T10:21:34+02:00 List-Id: On Mon, 06 Oct 2003 17:57:20 -0500, Wes Groleau wrote: >Dmitry A. Kazakov wrote: >> No, I want them same: >> >> type Array_Of_Same_Strings (Length : Positive) is >> array (Integer range <>) of >> String (1..Length); > >subtype Array_Element is String (1 .. Length); > >type Array_Of_Same_Strings (Length : Positive) is > array (Integer range <>) of Array_Element; It does not work, because then Array_Of_Same_Strings is no more a type, same for all possible elements (String). It is a generic solution, not a discriminant-based one. Each time you need another element size you have to instantiate. So you will have another type. Therefore you will not be able to write a non-generic subprogram working for all Array_Of_Same_Strings. So it is a "generic" type. >> Access types are inherently bad. After all this solution exists since >> K&R C. If you want to say that there are work-arounds odious to > >C's pointer to anything and Ada's access to >a specific type have VERY LITTLE in common. Like memory leaks. >I do not think an array of controlled types >is odious, nor do I have any problem using >an access type where appropriate. But since >you want the lengths the same, neither is needed. Really? Try to compile this: type X (I : Integer) is tagged null record; type Y is array (Integer range <>) of X; Observe that all X have same size. Note also that the trick of providing an arbitrary default for the discriminant would not work here, because X is tagged. --- Regards, Dmitry Kazakov www.dmitry-kazakov.de