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,602b7f606b0d64e2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-18 00:36:56 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!sjc70.webusenet.com!news.webusenet.com!wn11feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi.com!sccrnsc01.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Private discrete type as index References: X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc01 1042879016 12.234.13.56 (Sat, 18 Jan 2003 08:36:56 GMT) NNTP-Posting-Date: Sat, 18 Jan 2003 08:36:56 GMT Organization: AT&T Broadband Date: Sat, 18 Jan 2003 08:36:56 GMT Xref: archiver1.google.com comp.lang.ada:33167 Date: 2003-01-18T08:36:56+00:00 List-Id: > No. What I was originally trying to do was an abstraction as close > to the array as possible (booleans do not matter of course - just > something to put there). At the same time, I wanted to restrict > control of the index to the package implementing it > ... > So, while I realise I can't (in Ada) provide things like "..", I can > provide +/-/ operations of varying flavours on the index. This > would keep most (not all, but most) of the array semantics in place. type x is new integer; type test is array(x range <>) of boolean; function "+"(left, right:x) return x; function "-"(left, right:x) return x; function "*"(left, right:x) return x; etc. would give you quite a lot of control over the index. Granted you don't have "limited" and your user can get around you via type conversion, but, assuming some discipline by your user, is that amount of control still fatally inadequate for your purposes? I'm imagining for instance that "test" is really a giant array on disk, and you page in parts depending on the currently live index values. Or "test" is some kind of tree or graph and "x" is really a small record with bitfields telling where to go in the structure. Then perhaps "x+1" means "take the right branch", etc. A user's saying "test(x(123))" would be complete nonsense, but if he starts with your supplied constants and only does your "arithmetic", it could all make sense.