From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Unconstrained Arrays
Date: Wed, 25 Mar 2009 18:28:00 -0500
Date: 2009-03-25T18:28:00-05:00 [thread overview]
Message-ID: <gqeem2$lav$1@munin.nbi.dk> (raw)
In-Reply-To: wccy6ut1bi8.fsf@shell01.TheWorld.com
"Robert A Duff" <bobduff@shell01.TheWorld.com> wrote in message
news:wccy6ut1bi8.fsf@shell01.TheWorld.com...
> sjw <simon.j.wright@mac.com> 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.
next prev parent reply other threads:[~2009-03-25 23:28 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-17 0:59 Unconstrained Arrays belteshazzar
2009-03-17 1:49 ` Jeffrey R. Carter
2009-03-17 2:58 ` belteshazzar
2009-03-17 4:15 ` Jeffrey Creem
2009-03-17 5:20 ` Jeffrey R. Carter
2009-03-17 17:56 ` Jeffrey R. Carter
2009-03-17 23:10 ` belteshazzar
2009-03-18 18:31 ` Jeffrey R. Carter
2009-03-20 1:53 ` Peter C. Chapin
2009-03-20 6:45 ` sjw
2009-03-20 9:46 ` Jacob Sparre Andersen
2009-03-20 11:40 ` Jean-Pierre Rosen
2009-03-25 21:11 ` sjw
2009-03-25 22:30 ` Robert A Duff
2009-03-25 23:28 ` Randy Brukardt [this message]
2009-03-26 0:03 ` Jeffrey R. Carter
2009-03-26 1:00 ` Robert A Duff
2009-03-20 12:15 ` christoph.grein
2009-03-20 15:45 ` Adam Beneschan
2009-03-23 8:26 ` belteshazzar
2009-03-25 21:21 ` sjw
2009-03-25 22:03 ` Adam Beneschan
2009-03-26 1:32 ` tmoran
2009-03-27 8:39 ` Jean-Pierre Rosen
2009-03-27 20:07 ` sjw
2009-03-29 16:24 ` sjw
2009-03-27 11:57 ` Gautier
2009-03-17 15:33 ` Adam Beneschan
2009-03-17 23:00 ` belteshazzar
2009-03-17 20:14 ` anon
-- strict thread matches above, loose matches on Subject: below --
2001-12-11 17:17 Unconstrained arrays Michael Unverzagt
2001-12-11 18:22 ` Stephen Leake
2001-12-11 18:24 ` Mark Lundquist
1993-08-15 5:01 Alex Blakemore
1993-08-13 21:08 J. Craig Heberle
1993-08-13 12:34 Paul Durbin
1993-08-12 21:23 Robert Dewar
1993-08-12 19:25 Wes Groleau x1240 C73-8
1993-08-12 17:27 agate!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.ed
1993-08-12 16:26 Mark A Biggar
1993-08-12 16:00 Dave Collar d x7468
1993-08-12 15:28 Robert I. Eachus
1993-08-12 15:00 Robert Dewar
1993-08-12 13:03 Raymond Blaak
1993-08-12 12:14 cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!howland.
1993-08-12 12:03 cis.ohio-state.edu!pacific.mps.ohio-state.edu!math.ohio-state.edu!magnus.
1993-08-11 23:42 Kenneth Anderson
1993-08-11 23:40 cis.ohio-state.edu!math.ohio-state.edu!cs.utexas.edu!swrinde!menudo.uh.ed
1993-08-11 22:29 Kenneth Anderson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox