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,9c0dfd45a22e1cfa,start X-Google-Attributes: gid103376,public From: Anton Gibbs Subject: Procedure Access Values Date: 1998/02/12 Message-ID: <34E2B8C3.4D61@dera.gov.uk>#1/1 X-Deja-AN: 324387255 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Eurocontrol Integration Team Newsgroups: comp.lang.ada Date: 1998-02-12T00:00:00+00:00 List-Id: Please can someone help me to understand a problem I have run into using procedure access values. We have a system that uses call-back procedures in a manner similar to the following:- package Notifiers is type Callback_Type is access procedure; procedure Notify_Me_When_Event_Occurs( Callback : in Callback_Type ); end Notifiers; package P is procedure Start; end P; with Notifiers; package body P is procedure Event_Handler is ...; procedure Start is begin Notifiers.Notify_Me_When_Event_Occurs( Event_Handler'Access ); end Start; end P; This all works fine. The problem we have run into occurs when we convert package P into a generic. ie:- generic package P is procedure Start; end P; with Notifiers; package body P is procedure Event_Handler is ...; procedure Start is begin Notifiers.Notify_Me_When_Event_Occurs( Event_Handler'Access );--* end Start; end P; Now we get the following compilation error on the line marked *:- "access type must not be outside generic body" I realise that in Ada95 there are rules governing access values which are intended to prevent dangling references. What baffles me is that if the declaration of procedure Event_Handler is moved to the package specification, then the compiler accepts the 'Access without complaint. How can the legality of taking an access value depend on whether or not the procedure is local ? If anyone can shed any light on this I would be most grateful. Thank you. Anton Gibbs Eurocontrol