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,602b7f606b0d64e2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-17 08:28:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!newsfeed.mathworks.com!fu-berlin.de!uni-berlin.de!dialin-145-254-038-248.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Private discrete type as index Date: Fri, 17 Jan 2003 17:28:00 +0100 Organization: At home Message-ID: References: Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-038-248.arcor-ip.net (145.254.38.248) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: fu-berlin.de 1042820882 24375040 145.254.38.248 (16 [77047]) User-Agent: KNode/0.7.1 Xref: archiver1.google.com comp.lang.ada:33138 Date: 2003-01-17T17:28:00+01:00 List-Id: AG wrote: > > "Dmitry A. Kazakov" wrote in message > news:b0435c$la5bg$1@ID-77047.news.dfncis.de... >> tmoran@acm.org wrote: >> >> >> type x is limited private; >> >> type test is array(x) of boolean; >> > The "array" abstraction has certain characteristics, among them >> > sequential indexing. >> >> Why so? Array is just a mapping index->element, so if no index ranges >> required then the array index need not to be ordered (have "<" and "="), >> only "=" is required. > > I suppose the answer will be that index ranges *are* required > by the array semantics (in Ada, at least). But we are no more talking about Ada. (:-)) In Ada it is anyway impossible. And as for array semantics I would like to have two different kinds of arrays: ones with an ordered index (like in Ada) and others with an unordered index. Unordered arrays could to be used when index order may vary from platform to platform (so programmer cannot rely on ranges) and maybe for sparse arrays with very large indices and list representation. > But, as you pointed out: > >> Anyway a limited type is allowed to have both. > > So, it should be able to meet the range requirements too. > At least if the provider of the type also provides the minimum > set of operations. Such as ranges and the operations "..", 'range etc. This is even more distant from present Ada. -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de