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,1fa85f3df5841ae1 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.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: Thu, 28 Apr 2005 15:52:50 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <426e4c2b$0$7515$9b4e6d93@newsread2.arcor-online.net> <0uYbe.542$BE3.229@newsread2.news.pas.earthlink.net> Subject: Re: Ada.Containers.Vectors - querying multiple elements Date: Thu, 28 Apr 2005 15:55:25 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4927.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4927.1200 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-zhfTf8L8HjbNiytyneO2U3j1TRbK++PgdYqNZ+VMqCRK+/WFQ8uInm6QCCBSAUr7Wth1oQq0qng0G3t!kMlbSwF8g0VDN2zmtTja2tZT8FHgk23lQVBqYUNTT7PDLtiVtuqiUr469Q+Mv7gPLmOZXjEJhOAz 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:10788 Date: 2005-04-28T15:55:25-05:00 List-Id: "Jeffrey Carter" wrote in message news:0uYbe.542$BE3.229@newsread2.news.pas.earthlink.net... ... > The definition of Last was driven by the decision to allow null > unbounded arrays regardless of the base range of Index. Currently, > unconstrained Ada array types can exist that don't have null arrays. > IIRC, this will be corrected in Ada 0X; if you allow them for arrays, > you ought to allow them for the unbounded-array abstraction. It's not really corrected in Ada 2006; it has additional aggregates that help, but the basic problem of having to mess with the bounds still exists: Obj : Some_Array (Enum'First .. Enum'Val(Enum'Pos(Enum'First)+Some_Length-1); doesn't work if Some_Length = 0 and there is no general way to fix that. You just have to special case Some_Length = 0 and that is unpleasant. The solution that Ada.Containers.Vector took to this problem is essentially to ban instantiating it with subtypes where 'First = 'Base'First. (OK, you can do the instantiation, but it will raise Constraint_Error.) One can argue whether that is the best solution, but it seems clear that all of the possible solutions are ugly. Randy.