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,73175d2d01a1b1dd X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!newsfeed2.dallas1.level3.net!newsfeed3.dallas1.level3.net!news.level3.com!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: subprogram must not be deeper than access type Date: Sun, 25 Sep 2011 10:23:35 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1316960615 13019 192.74.137.71 (25 Sep 2011 14:23:35 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sun, 25 Sep 2011 14:23:35 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:syjRkK/EY9siWMyBgETvowAH5Fk= Xref: g2news2.google.com comp.lang.ada:22062 Date: 2011-09-25T10:23:35-04:00 List-Id: Natasha Kerensikova writes: > And GNAT refused to compile it, because "subprogram must not be deeper > than access type". > > So I imagined that since Builder and Output have the same lifetime, it > might not be so well-define which will cease to exist first. Note that the error message says "access TYPE". The Output object has nothing to do with it. It is complaining because the access type is at library level, whereas Builder is nested inside Main. >...So while > not strictly deeper, being as deep can be a problem. No, two things at the same level have lifetimes that end at the same time. I don't really understand what you're trying to do, so I can't advise you how to fix it. It might be better to use dispatching procedures rather than access-to-procedure. It's probably best if you avoid putting any significant code inside your main procedure. Put everything in library packages or generic packages, and make the main procedure just one line. - Bob