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: a07f3367d7,3ebfb7ec7bfb06fa X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.82.1 with SMTP id e1mr2386054wiy.1.1360548877923; Sun, 10 Feb 2013 18:14:37 -0800 (PST) Path: g1ni3804wig.0!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!216.196.110.146.MISMATCH!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!newsreader4.netcologne.de!news.netcologne.de!news.glorb.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Passing indefinite types References: <5262a822-409a-4c79-a842-0e716527cb70@googlegroups.com> Date: Sun, 03 Feb 2013 17:26:15 -0500 Message-ID: <85ip696nlk.fsf@stephe-leake.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (windows-nt) Cancel-Lock: sha1:2lDI/phRelCEldSAwTGlD7AmvjQ= MIME-Version: 1.0 X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: ef4a6510ee409c55ab71419615 X-Received-Bytes: 2284 Content-Type: text/plain Date: 2013-02-03T17:26:15-05:00 List-Id: sbelmont700@gmail.com writes: > Does anyone know of a slick way to pass several locally declared, > indefinite types to a subprogram without resorting to the heap or > Unchecked_Access? Could you show some almost legal code? > An array of indefinite types is obviously not possible, an array of > named access types is subject to accessibility problems, and wrapping > the object in an 'accessor' (i.e. a null record with an access > discriminant) turns right back into a problem of an array of > indefinite types. I can always declare a procedure that takes a bunch > of individual parameters, but this seems like a kludge, and doesn't > solve the problem if the number of items might vary. It would be nice > if there was some way to establish that a discriminated record is in > fact a fixed size, Is it fixed, or does it vary? you point out several solutions for fixed. > or perhaps if an array of anonymous access types had the same > accessibility as access discriminants. I gather the subprogram you are calling is at library level, or at least at a less deep accessibility level than the objects? While the local objects are on the stack. How is the subprogram declared? If it takes several parameters each of different indefinite type, then you are fine. If it takes a record of indefinite types, then they all must be access types, and Unchecked_Acess is ok, as long as the subprogram promises not to copy the pointer. I wonder if it would be possible to write an aspect or other constraint that asserts "no pointers are copied"? -- -- Stephe