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,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,28b389d4503cb555 X-Google-Attributes: gid103376,public From: Mats Weber Subject: Re: generic package dilemma Date: 1999/11/19 Message-ID: <383510EA.9DFEE8B6@mail.com>#1/1 X-Deja-AN: 550464014 Content-Transfer-Encoding: 7bit References: <80u48b$ghr$1@bunyip.cc.uq.edu.au> <3832e27f_1@news1.prserv.net> <3832E75D.5B1BA719@mail.com> <383319e8_4@news1.prserv.net> <3833F615.5AD7166C@mail.com> <383442e1_1@news1.prserv.net> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@sunrise.ch X-Trace: news1.sunrise.ch 943001799 29274 195.141.231.162 (19 Nov 1999 08:56:39 GMT) Organization: sunrise communications ag Mime-Version: 1.0 NNTP-Posting-Date: 19 Nov 1999 08:56:39 GMT Newsgroups: comp.lang.ada Date: 1999-11-19T08:56:39+00:00 List-Id: Matthew Heaney wrote: > > In article <3833F615.5AD7166C@mail.com> , Mats Weber > wrote: > > > It does: if the generic instantiates another generic, e.g. > > > > generic package P1 is ... > > > > generic package P2 is ... > > > > with P1; > > package body P2 is > > package P1I is new P1; > > end P2; > > But isn't this wrong? Shouldn't P2 elaborate P1? > > with P1; > pragma Elaborate (P1); > > package body P2 is > package P1I is new P1; > end P2; Suppose someone else wrote P2 or is still developping it, and that person does not use pragma Elaborate. With Elaborate_All, you are safe. > > The clause > > > > with P2; > > pragma Elaborate(P2); > > > > does not guarantee that P1's body gets elaborated. > > Is this still true if P2 does the proper thing, and elaborates P1? No. I totally agree with Robert Dewar here: never use Elaborate, use Elaborate_All instead. Your approach of using Elaborate at each level, besides being hard to enforce on a large project, puts unnecessary constraints on the elaboration order: in our example, where P2I instantiates P2 instantiates P1, valid elaboration orders are: P1, P2, P2I and P2, P1, P2I. You are unnecessarily enforcing the first one with your approach. I have done an extensive study of the shortcomings of pragma Elaborate in my thesis at http://lglwww.epfl.ch/Team/MW/Ada-Extensions/Ada-Extensions.html