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,24d7acf9b853aac8 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!193.201.147.84.MISMATCH!xlned.com!feeder1.xlned.com!news.netcologne.de!newsfeed-fusi2.netcologne.de!newsfeed.straub-nv.de!noris.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: S-expression I/O in Ada Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.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: <547afa6b-731e-475f-a7f2-eaefefb25861@k8g2000prh.googlegroups.com> <1qk2k63kzh7yv$.3jgc403xcqdw$.dlg@40tude.net> <8ae8e899-9eef-4c8c-982e-bfdfc10072f1@h17g2000pri.googlegroups.com> <258zlxrv4fn6.1vszho1rtmf48$.dlg@40tude.net> <984db477-973c-4a66-9bf6-e5348c9b95f2@n19g2000prf.googlegroups.com> <46866b8yq8nn$.151lqiwa0y2k6.dlg@40tude.net> <13b07f2c-2f35-43e0-83c5-1b572c65d323@y11g2000yqm.googlegroups.com> <13tpf7ya3evig$.h05p3x08059s$.dlg@40tude.net> <1omt2srxtpsga$.c3hbxthzo6cf.dlg@40tude.net> Date: Sun, 8 Aug 2010 22:39:11 +0200 Message-ID: <1e4cch2df5uyb.18brqdd16dhv8.dlg@40tude.net> NNTP-Posting-Date: 08 Aug 2010 22:39:11 CEST NNTP-Posting-Host: 2afc78b0.newsspool3.arcor-online.net X-Trace: DXC=;@heFZUH8O`^Y=RbYBPl4`McF=Q^Z^V3h4Fo<]lROoRa8kF1@A\TYiM3k[6LHn;2LCVn[ On Sun, 08 Aug 2010 16:03:22 -0400, Robert A Duff wrote: > For scalars, the primitive operations mostly don't know the > subtype bounds -- they are operations of the type. So this > wouldn't fit into Ada well. But array subtypes silently modify their operations or, if you want, parametrize them using the dope. A modular subtype would have a dope as well. >> ...then they could be used as indices. > > The problem I was alluding to is that if you have > an unconstrained array type, sooner or later you might > have an empty one. So you want bounds 0..-1, but -1 > wraps around. Empty range does not have bounds. What are bounds of type Empty is mod 0; -- Illegal in Ada, but must be legal > Same thing with a "for" loop that goes from T'First up to > something. If ranges (contiguous sets of indices) were proper types you would be able to construct them in many different ways. E.g. function ":" (From : Index; Length : Universal_Integer) return Index'Range L := 0 ... for I in T'First :L loop instead of what you can find in every Ada program: for I in T'First..T'First + L - 1 loop or for enumerations: for I in T'First..T'Val (T'Pos (T'First) + L - 1) loop which does not work anyway... > If 2..10 wrapped around, then you'd want range 2..1, which > has the same problem. 2..1 actually is 2,3,4,5,6,7,8,9,1 Modular numbers are not ordered. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de