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-06 05:15:56 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!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: Mon, 06 Oct 2003 14:25:11 +0200 Message-ID: References: <834clb.uan1.ln@skymaster> <3F79EF18.7060600@comcast.net> <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 1065442554 15867927 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:302 Date: 2003-10-06T14:25:11+02:00 List-Id: On Sat, 04 Oct 2003 19:49:44 -0500, Wes Groleau wrote: >Dmitry A. Kazakov wrote: >> Observe that this disgusting construction does not serve the purpose, >> because it allocates the memory for the worst case. > >Of course it does. I understand you want constrained >sizes that are not the same, No, I want them same: type Array_Of_Same_Strings (Length : Positive) is array (Integer range <>) of String (1..Length); Note, that Bounded_String do have *same* sizes [if their maximal length is same]. If their design were non-generic: type Bounded_String (Max_Length : Positive) is record ... end record; then with array discriminants one could have quasi-ragged arrays, which are *not* in fact ragged: type Array_Of_Varying_Strings (Max_Length : Positive) is array (Integer range <>) of Bounded_String (Max_Length); >but if you are willing >to make the type have unconstrained elements, nothing >prevents you from putting contrained ones into those slots. > >To minimize memory usage in a ragged array, access types >work quite well and do not add significant complexity. >Make them controlled if you're worried about cleanup. 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 different grades. Yes, they are. --- Regards, Dmitry Kazakov www.dmitry-kazakov.de