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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,3a3d295a91a47a88 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!proxad.net!freenix!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Preelaborable generic body: question Date: 29 Nov 2004 21:43:26 -0500 Organization: Cuivre, Argent, Or Message-ID: References: NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: melchior.cuivre.fr.eu.org 1101782649 96398 212.85.156.195 (30 Nov 2004 02:44:09 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Tue, 30 Nov 2004 02:44:09 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: In-Reply-To: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:6659 Date: 2004-11-29T21:43:26-05:00 adam@irvine.com (Adam Beneschan) writes: > In this example: > > generic > x1: integer; > package pak2 is > pragma Preelaborate; > pragma Elaborate_Body; > end pak2; > > package body pak2 is > x2: integer := x1; > end pak2; > > My reading is that 10.2.1(10) makes this illegal, because it's > possible to instantiate pak2 with an actual for "x1" that would cause > the declaration of x2 to perform an action that 10.2.1(6-7) makes > nonpreelaborable. (You could instantiate pak2 with an actual that > contains a function call or the name of an object, e.g.) Interesting. ALRM 1.a tends to support your view: 1.a The legality of an instance should be determinable without looking at the generic body. Likewise, the legality of a generic body should be determinable without looking at any instances. However, 12.3 (21) says (about instantiating a generic): For the evaluation of a generic_association the generic actual parameter is evaluated. ALRM 12.4 (1.a) says: 1.a A generic formal object of mode in is like a constant initialized to the value of the explicit_generic_actual_parameter. So the action of evaluating your hypothetical function is at the point of elaborating the declaration of x1, not in the body of pak2. So it is the instantiation that is not preelaborable, not pak2 itself. Hmm. On the other hand, I think the declaration of x1 is in the spec of the instance of pak2, so that makes any generic formal object non-preelaborable. I hope that's not right! But I'm not really a language lawyer :). -- -- Stephe