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-Thread: 103376,1cb75f0476fe2d1a X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Fri, 10 Mar 2006 18:18:54 -0600 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <1141667416.163432.304280@p10g2000cwp.googlegroups.com> Subject: Re: Half Constrained Array Types and Slices Date: Fri, 10 Mar 2006 18:19:02 -0600 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: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-ktumCIWGEQN7EfmuamyuQ0bz4GOlWj3uu9KAXrllEzmjSlBU2L/f+mlr4h9KoW0StlxweLgs20v4YYV!odcCLa1Upl/RxXDQX5hqRMNVzumEEaMxKc6bAiv3HeIZeVPodO41dT0up6uPEQBTA8kp0Aq5u9fk!ZNbkC+bXEOojCQ== X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:3328 Date: 2006-03-10T18:19:02-06:00 List-Id: "Robert A Duff" wrote in message news:wccmzfyurm5.fsf@shell01.TheWorld.com... > "Jeffrey R. Carter" writes: > > I think the index type should be discrete. But surely it doesn't need to > > be an integer: > > > > with Ada.Text_IO; > > procedure Null_Range is > > type A is (B, C); > > > > type D is array (A range <>) of Integer; > > > > E : D (C .. B); > > begin -- Null_Range > > Ada.Text_IO.Put_Line (Item => A'Image (E'Last) ); > > end Null_Range; > > > > This is valid Ada. > > Indeed it is. I don't think it's very useful, however. > My claim is that if you want empty arrays, you almost > certainly want to index them by (non-modular) integers. > Which is why I'm happy with the restriction in the Containers > library that Vector indices must be signed integers. I don't buy this, especially in the case of modular integers, but even in the case of large enumeration sets (like Character). I don't see any reason to think that integers are special; the whole reason for allowing non-integer array indexes is for greater abstraction. Empty arrays are never very useful, but I don't think there is much reason to say that they'll useful in the one case but not the other. That's essentially that same as saying that integers are more useful as array indexes; in that case, why bother allowing anything else as array indexes? Of course, I was very against the restriction in the Containers library, too... Randy.