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: a07f3367d7,e276c1ed16429c03 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Ada is getting more popular! 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: <4cb5c768$0$6764$9b4e6d93@newsspool3.arcor-online.net> Date: Wed, 13 Oct 2010 19:00:53 +0200 Message-ID: <1nbbizl9r5irq.1jxdp29n5gxic$.dlg@40tude.net> NNTP-Posting-Date: 13 Oct 2010 19:00:50 CEST NNTP-Posting-Host: ca9545a7.newsspool4.arcor-online.net X-Trace: DXC=@Oc?_RHm_dUU6b:FjPaGjQ4IUK On Wed, 13 Oct 2010 16:51:19 +0200, Georg Bauhaus wrote: > On 13.10.10 14:07, ramon_garcia wrote: >> type my_container(counter: integer, discriminated_attribute: integer) >> is record >> data: array(0..counter) of contained(discriminated_attribute); >> end record; >> >> This straightforward way is not posible because one cannot use an >> anonymous array type inside a record (by the way, I find this feature >> unjustified). > > I think it's justified insofar as you can't have both separate > compilation and dope-free representation of My_Container. Note that the following is perfectly legal: type My_Container (Counter : Natural) is record Data : String (1..Counter); end record; The issue has nothing to do with array dopes. The problem is that arrays may not have discriminants. Therefore you cannot constrain an array otherwise than in its bounds. If arrays had discriminants, OP could achieve his goal: type Not_A_Ragged_Array (Length : Natural) is array (Positive range <>) of String (1..Length); type My_Container (Counter : Natural, Length : Natural) is record Data : Not_A_Ragged_Array (Length, 1..Counter); end record; [ I wonder that OP complaints about features (constrained types) of which other languages lack slightest traces. ] > procedure P(Simple : in out My_Container) is > > -- Problem: what's the address of Simple.Data(N) > -- in case there are no dope vectors? Maybe Simple.Data(N) does not have a unique address at all. Why should you care how does the compiler pack arrays? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de