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,5b3aa4bc9027f04e X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!cyclone1.gnilink.net!gnilink.net!nx02.iad.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!oleane.net!oleane!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Unconstrained Arrays Date: Wed, 25 Mar 2009 18:28:00 -0500 Organization: Jacob Sparre Andersen Message-ID: References: <1a8008fb-c840-45bc-824c-d10eec9fe569@d36g2000prf.googlegroups.com> <0caa9cf8-0620-4544-9b2c-2c9f24142b7f@v23g2000pro.googlegroups.com> <386b0e00-a1c6-4c5f-adf7-89b8543d0e2d@c11g2000yqj.googlegroups.com> <46281cbb-2804-41e8-87a0-251c9060d4d1@c36g2000yqn.googlegroups.com> <4c7128dd-085c-48b0-948f-401fcd64c2a4@c36g2000yqn.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1238023682 21855 69.95.181.76 (25 Mar 2009 23:28:02 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Wed, 25 Mar 2009 23:28:02 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-RFC2646: Format=Flowed; Original Xref: g2news2.google.com comp.lang.ada:5291 Date: 2009-03-25T18:28:00-05:00 List-Id: "Robert A Duff" wrote in message news:wccy6ut1bi8.fsf@shell01.TheWorld.com... > sjw writes: ... > Well, GNAT is right in the sense that it obeys the Ada RM on this point. > But some people (including some of the folks who wrote GNAT) think the > language designers were wrong on this point. It's an efficiency issue. > You can certainly come up with cases that make a big difference: > > subtype S is String (1..4); > type A is array (Positive range <>) of aliased S; > X : A (1..1_000_000); > > type S_Ref is access all S; > > An object of subtype S is likely 4 bytes without dope, 12 bytes with > dope. Removing this restriction from the language would triple > the size of X from 4 million bytes to 12 million. If you only > wanted to point at components of X from objects of type S_Ref, > (as opposed to some "access all String" type) then that would be > annoying (why store 1 million copies of the compile-time-known > values 1 and 4?). There is another option if you use non-contiguous dope (as Janus/Ada does): create the dope on the fly when the 'Access is encountered. That's what we did in our Ada 9x prototype compiler (before the "static matching" rule was added to Ada 9x). The problem is that recovering the dope's memory is hard in that case (you can't do it until either the object or the access type go out of scope), and we didn't have a way to do it then (we hadn't implemented finalization at that time). As I recall, when I complained about the problem and asked for advice, you guys added the "static matching" rule. Which eliminated this problem but also made many safe and easy cases illegal. (OT3H, some of those "safe" cases have other problems - see my response to Adam on Ada-Comment.) It is interesting, though, that virtually every complaint I've seen on this has always been asking about the case which is prohibitively expensive to implement (either in complexity or in space used) -- no one seems concerned about the "easy" cases that are illegal. Randy.