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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e9184f90d0749b32 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Using a procedure as a parameter (Gnat) Date: 1996/03/27 Message-ID: #1/1 X-Deja-AN: 144403430 references: <4ja0da$442@newsflash.concordia.ca> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-03-27T00:00:00+00:00 List-Id: In article <4ja0da$442@newsflash.concordia.ca>, Chris O'Regan wrote: >ack.adb:11:35: subprogram must not be deeper than access type Deeper means more deeply nested within subprograms (packages don't count). In your case, you can easily move the procedure into a package, since it doesn't reference any local variables in the next-outer procedure. So put P in a library package, and all will be well. Sometimes, the procedure you want to pass wants to reference variables in the next-outer procedure. In that case, you can use GNAT's 'Unrestricted_Access. But beware: (1) it's not a standard feature, and (2) it can cause dangling pointers if you're not careful. A better alternative might be to use a generic formal subprogram. - Bob