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,ae9506fd4dcf7090 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-24 07:16:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-06!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: Concatenation and Characters Date: Thu, 24 Oct 2002 10:13:14 -0400 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <44hp9.807$_u6.205@nwrddc01.gnilink.net> <3DA5AE5F.3030902@attbi.com> <3DB03EF1.EE771923@mmm.com> <3DB43EB0.AAF4B38C@mmm.com> <3DB44B9C.80007@worldnet.att.net> <3DB466CB.7CE0BC59@mmm.com> <3DB4C9C4.1070003@worldnet.att.net> <7PAt9.4014$iV1.789@nwrddc02.gnilink.net> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:30096 Date: 2002-10-24T10:13:14-04:00 List-Id: "Fraser Wilson" wrote in message news:uhefc429n.fsf@FWILSON.i-did-not-set--mail-host-address--so-shoot-me... > "Frank J. Lhota" writes: > > > Consider this: > > > > type Great_One is ( Jackie_Gleason ); > > > > type S is array( Great_One range <> ) of Honeymooner; > > > > What would S'Empty'First and S'Empty'Last return? > > It's certainly (imho) a bit of a wart that you need at least two > elements in the A'Range'Base to make a zero-length array. And it's > not clear that 'First and 'Last should be defined at all when 'Range > is empty, although it's certainly convenient sometimes. The issue is that an enumeration type is "its own base type." The problem is in the declaration of Great_One, which really should have been done like this: type Great_One_Base is (Great_One_Base_First, Jackie_Gleason, Great_One_Base_Last); subtype Great_One is Great_One_Base range Great_One_Base'Succ (Great_One_Base_First) .. Great_One_Base'Pred (Great_One_Base_Last); type S is array (Great_One range <>) of Honeymooner. Now all the problems go away. Yes, this is sort of a pain, but it's simply a consequence of Ada's type model for enumerations. For integer discrete types, the language gives you T'Base for free, but for enumerations you have to declare T'Base manually. You have the same issue when instantiating the Charles vector package, which accepts a discrete type as a generic formal index type. The web page has an explanation similar to what appears above. http://home.earthlink.net/~matthewjheaney/charles/charles-vectors-unbounded. html The most recent release occured on 2002/10/21. http://home.earthlink.net/~matthewjheaney/charles/index.html