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,FREEMAIL_FROM,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,602b7f606b0d64e2,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-10 16:41:22 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.media.kyoto-u.ac.jp!newsfeed01.tsnz.net!news.xtra.co.nz!53ab2750!not-for-mail From: "AG" Newsgroups: comp.lang.ada Subject: Private discrete type as index X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: Date: Sat, 11 Jan 2003 13:42:54 -0800 NNTP-Posting-Host: 219.88.61.180 X-Complaints-To: newsadmin@xtra.co.nz X-Trace: news.xtra.co.nz 1042245681 219.88.61.180 (Sat, 11 Jan 2003 13:41:21 NZDT) NNTP-Posting-Date: Sat, 11 Jan 2003 13:41:21 NZDT Organization: Xtra Xref: archiver1.google.com comp.lang.ada:32899 Date: 2003-01-11T13:42:54-08:00 List-Id: Hi all, Guess I have a question that I'm a bit puzzled about. Consider the boiled-down code snippet: package test is type x is limited private; type test is array(x) of boolean; private type x is new boolean; end test; Trying to compile that fails on GNAT with "Discrete type required" error. Can't blame it, of course, since it's correct according to LRM. But... the obvious intention was to provide a set of "+/-" operations etc on the limited type (which are not trivial) and prevent the out-of-package clients from messing with the index. Since the compiler obviously knows the implementation details, why not? Of course, it can be implemented as an iterator, but what's wrong with the example as written? After all, the client modules can't use that index other than through the type and operation provided by the package. Compiler/linker sure knows what the type is. So, why not?