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,ASCII-7-bit X-Google-Thread: 103376,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-03 13:24:57 PST Path: archiver1.google.com!news2.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!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: Counter-proposal for variable arrays Date: Fri, 03 Oct 2003 22:29:53 +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> 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=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.uni-berlin.de 1065212695 13980998 145.254.38.72 (16 [77047]) User-Agent: KNode/0.7.2 Xref: archiver1.google.com comp.lang.ada:168 Date: 2003-10-03T22:29:53+02:00 List-Id: Wes Groleau wrote: > Dmitry A. Kazakov wrote: >> Which only means that there is a deficiency in array design. They have >> to be allowed to have discriminants. Then: > > Even better (if it doesn't open some can of worms) > would be > > (sub)type Variable (Lower : := Upper : := default) > is array (Lower .. Upper) of ; > > Varies : Variable; This is another thing. You want to expose the array bounds as discriminants it would be also possible. But the main problem with arrays is an inability to constrain elements together with the array: type Line_Buffer (Height, Width : Positive) is array (Integer range 1..Height) of String (1..Width); -- Illegal Moreover, if type tags were considered as discriminants (and they should), one could even have the arrays of class-wide elements, which could save rather painful and clumsy attempts to design generic containers "a la" STL. After all the whole idea behind STL containers is to provide arrays which C++ does not have! Yet another issue is the defaults for discriminants. I think that the idea to tie an existence of the defaults with treating the type constrained (by the maximal size) was altogether wrong. These issues are unrelated. There should be a different and a better way to specify this. Especially, to have constrained subsets of X'Class. For instance, by specifying the whole range of tags X'Class might have. -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de