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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,72113392dc4997bd X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-16 20:13:00 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!opentransit.net!wanadoo.fr!freenix!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Samuel Tardieu Newsgroups: comp.lang.ada Subject: Re: Subprogram Pointer in a Generic Date: Thu, 17 Apr 2003 03:12:55 +0000 (UTC) Organization: DnS network Message-ID: References: <1ftiuys.1twhum2q9qa00N%claveman@grzorgenplatz.net> NNTP-Posting-Host: m34.net81-65-250.noos.fr X-Trace: melchior.cuivre.fr.eu.org 1050549175 75854 81.65.250.34 (17 Apr 2003 03:12:55 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Thu, 17 Apr 2003 03:12:55 +0000 (UTC) User-Agent: slrn/0.9.7.4 (FreeBSD) Cache-Post-Path: willow.dyn.rfc1149.net!unknown@localhost X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) Xref: archiver1.google.com comp.lang.ada:36225 Date: 2003-04-17T03:12:55+00:00 List-Id: Charles H. Sampson wrote: > There are two questions. (1) What are they trying to prevent by > this restriction? (2) Is there a more robust way of working around it? (1) The absence of such a rule would prevent an implementation from implementing efficiently shared generic packages: if, from within the body, you take a reference to a local subprogram, you do not statically know the accessibility "depth", as the generic package may be instantiated locally (from within a subprogram for example). Note that building the access value from outside the generic package then storing it is subject to the classical static accessibility rules and thus does not require this restriction. However, I must admit that I do not understand why it is not sufficient for the access to subprogram type to be declared in the corresponding generic declaration, as both accessibility levels can be statically compared when compiling the generic package body. Should this restriction be alleviated in Ada 2005? (2) If you *know* that you can safely use such a reference, use your (non portable) compiler-provided attribute ('Unrestricted_Access for GNAT) to create the access value. Another solution would be to export the subprogram if not done already and build the access value from outside. Sam -- Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/sam