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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-15 17:50:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!sjc70.webusenet.com!news.webusenet.com!pd2nf1so.cg.shawcable.net!residential.shaw.ca!sn-xit-03!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Counter-proposal for variable arrays Date: Wed, 15 Oct 2003 19:52:22 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <3F7B1076.8060106@comcast.net> <5mknnv4u96qqudrt4bd8n4t1cljp2fjlp8@4ax.com> <1065215180.95094@master.nyc.kbcfp.com> <19p2ovk1jh4krn2h5cql44p37ovf6va99i@4ax.com> <4pe7ov0gsepk8p8cq88ropvq4sookdhatk@4ax.com> <1065635640.270857@master.nyc.kbcfp.com> <725aovsqh10dv5p5nh1e7k2qvjjcqustsa@4ax.com> <1065709998.992831@master.nyc.kbcfp.com> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:929 Date: 2003-10-15T19:52:22-05:00 List-Id: "Hyman Rosen" wrote in message news:1065709998.992831@master.nyc.kbcfp.com... > Dmitry A. Kazakov wrote: > > It is already so. Consider: > > type Tricky (I, J : Positive) is record > > X : String (1..I); > > Y : String (1..J); > > end record; > > The offset to Y is variable and depends on the value of I. > > I Didn't Know You Could Do That In Ada(tm). :-) > It really works that way? And you can have procedures > which just take unconstrained Tricky parameters, and > they'll know how to deal with all instances? Cool! You can write this, but it often isn't implemented with variable offsets. What Janus/Ada does is to use discontinous storage for depends-on-discriminant components. The component itself is a descriptor, and has fixed size. The array data is allocated separately. That way, we can actually change the data memory when the discriminants are changed by assignment, and we don't use more memory than necessary. Most other compilers don't do that, but I know that some at least use extra pointers in cases like the above to avoid having non-static offsets. On the other hand, if you do generic code sharing (as Janus/Ada does), you end up with dynamic offsets, dispatching slots, tags, array strides, object sizes, and pretty much everything else. (But usually not all at the same time!) Randy. > > > For good or bad, neither Ada is C++ nor I have Stroustrup's influence > > on the language design. There should be some consensus reached. And of > > course, any change undertaken have to be carefully reviewed. > > Don't underestimate the power of Just Doing It. You know how they > say that it's easier to get forgiveness than permission. If the > feature were actually added to a popular compiler and worked well, > that would be a big step in gaining acceptance. >