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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,c6b9934af04bce01,start X-Google-Attributes: gid103376,public From: Bernd Rinn Subject: A question to the "access-type lifetime rule" Date: 2000/04/03 Message-ID: <38E89AB9.7D33E88C@hamilton.physik.uni-konstanz.de>#1/1 X-Deja-AN: 606044535 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=iso-8859-1 X-Trace: 3 Apr 2000 15:20:58 +0100, 134.34.147.33 Organization: University of Constance, Germany MIME-Version: 1.0 Reply-To: bernd.rinn@uni-konstanz.de Newsgroups: comp.lang.ada Date: 2000-04-03T00:00:00+00:00 List-Id: Hi, I am new to Ada and I am looking for an elegant way to get around a restriction posed by the "access-type lifetime rule" for access-to-subprogram types. First of all: does anyone know, why the access-type lifetime matters and not the access-variable lifetime? (This should prevent dangling pointers as well, I guess.) I want to write an numerical integration function, that is defined in a separate package as type Integrand_Type is access function ( X : Long_Float ) return Long_Float; function Integrate(Integrand : Integrand_Type; Lower_Bound, Upper_Bound : Long_Float) return Long_Float; Now I would like to call this from a main procedure and pass an access attribute of a nested function of the main procedure as `Integrand'. Is there a way to reach this? (Unchecked_Access is not an allowed attribute for subprograms and I do not want to generate a package of it's own for the integrand function.) Thank you for your help. Best regards, Bernd -- Bernd Rinn Fakult�t f�r Physik Universit�t Konstanz Tel. 07531/88-3812, e-mail: Bernd.Rinn@uni-konstanz.de PGP-Fingerprint: 1F AC 31 64 FF EF A9 67 6E 0D 4C 26 0B E7 ED 5C