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-Language: ENGLISH,UTF8 X-Google-Thread: 103376,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-03 13:25:04 PST Path: archiver1.google.com!news2.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!dialin-145-254-038-072.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Is the Writing on the Wall for Ada? Date: Fri, 03 Oct 2003 22:30:02 +0200 Organization: At home Message-ID: References: <3F739C1D.4030907@attbi.com> <3F78E850.8010401@comcast.net> <3F797748.3000203@noplace.com> <834clb.uan1.ln@skymaster> <3F79EF18.7060600@comcast.net> <3F7B1076.8060106@comcast.net> <5mknnv4u96qqudrt4bd8n4t1cljp2fjlp8@4ax.com> <3F7C810E.7070100@comcast.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-038-072.arcor-ip.net (145.254.38.72) Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8Bit X-Trace: news.uni-berlin.de 1065212701 13980998 145.254.38.72 (16 [77047]) User-Agent: KNode/0.7.2 Xref: archiver1.google.com comp.lang.ada:169 Date: 2003-10-03T22:30:02+02:00 List-Id: Robert I. Eachus wrote: > Dmitry A. Kazakov wrote: > > > Which only means that there is a deficiency in array design. They > > have to be allowed to have discriminants... > > You can't have thought about this. Ada does allow Multidimensional > arrays, arrays of arrays, and ragged arrays. But they are different, > and vivé la difference. I could even create an ISAM type in Ada, but > why bother, ragged arrays are usually better. The point is though that > all of these structures have structure invariants which are different. > > An array is a structure where all the elements are alike. Ada lets you > play games by "hiding" properties of elemental types to get this > alikeness. You can have arrays of types with discriminants, but if you > do, all the elements in an array have the same discriminant. This is what I want. And this is what arrays cannot: type Element (Constraint : Natural) is ...; type Array_Of_Elements is array (...) of Element; This is not allowed, because I cannot constrain Element, and there is no way to do it other than create a constrained subtype of Element. Even if I pack the array into a record to have a discriminant, even so, it will be still illegal: type Array_Of_Same_Elements (Constraint : Natural) is record Body : array (...) of Element (Constraint); end record; Note that it is *not* a ragged array. All elements are of exactly *same* size. What is required is: type Array_Of_Same_Elements (Constraint : Natural) is array (...) of Element (Constraint); -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de