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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!news4.google.com!news.glorb.com!newsgate.cistron.nl!transit2.news.xs4all.nl!transit.news.xs4all.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!proxad.net!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Half Constrained Array Types and Slices Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1141667416.163432.304280@p10g2000cwp.googlegroups.com> <1pfxe79p64svi.1txsf811gbkrr.dlg@40tude.net> Date: Fri, 10 Mar 2006 22:24:30 +0100 Message-ID: NNTP-Posting-Date: 10 Mar 2006 22:24:28 MET NNTP-Posting-Host: 39872f81.newsread2.arcor-online.net X-Trace: DXC=F45L^T\aZI=RTD7Kih:TB8Q5U85hF6f;4jW\KbG]kaM8ZmYl>WOG@=5FKS@OMU9nk?[6LHn;2LCV>[70DZQT9 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:3327 Date: 2006-03-10T22:24:28+01:00 List-Id: On 10 Mar 2006 12:33:46 -0500, Robert A Duff wrote: > "Dmitry A. Kazakov" writes: > >> There is, but for most of finite bounds a string range would contain an >> uncountable number of items. For example "A".."B". This range includes >> "AA", "AAA", etc. This might be is undesirable, however, it would be >> interesting to think about how to deal with bounded infinite ranges, like >> "A".."B". > > Note quite infinite, since X'Last <= Natural'Last for all Strings X. > And I suppose the highest value of String is: > > (Positive => Character'Last) > > This leads nowhere useful! ;-) OK, but "universal string" indexed by universal integer are truly infinite. (:-)) > If you want "arrays" indexed by strings, you really want sparse arrays > implemented as hash tables or some such. I call those "mappings", not > "arrays". Can't a map have indexing operation? Should indexing always imply ranges? I think the visible interface of the corresponding index type should determine whether ranges exist. If Map'Index'Succ isn't defined, then there is no Map'Range and, so it is not an ordered container. >>... After all [universal] floating-point ranges are allowed in Ada, >> and they aren't finite... > > And they're not allowed in 'for' loops, nor as array indices. > Which is a good thing. Nevertheless they exist. So there should be a rational answer why 0.0..1.0 is legal, but "A".."B" is not. BTW, that the range bounds may be outside the range they specify, is not unique for enumeration types. A similar thing shows itself for fixed point types: delta ... range 0.0..1.0; It seems that the problem lies deeper... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de