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,3849a7e484f56749 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-11 13:56:56 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: adam@irvine.com (Adam Beneschan) Newsgroups: comp.lang.ada Subject: Re: generic packages Date: 11 Jul 2002 13:56:55 -0700 Organization: http://groups.google.com/ Message-ID: References: <3D2ADF27.8070502@wanadoo.fr> <3D2D8B01.9040303@wanadoo.fr> NNTP-Posting-Host: 66.126.103.122 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1026421016 24556 127.0.0.1 (11 Jul 2002 20:56:56 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 11 Jul 2002 20:56:56 GMT Xref: archiver1.google.com comp.lang.ada:27011 Date: 2002-07-11T20:56:56+00:00 List-Id: Sami Evangelista wrote in message news:<3D2D8B01.9040303@wanadoo.fr>... > thank you for your response, but does the following code compile? > > ======================================================= > --file generic_set.ads > > generic > type Element is private; > with function "=" (E1, E2 : in Element) return boolean; > package Generic_Set is > type Set_Record is private; > type Set is private; > generic > with package a_set is new generic_set(<>); > with package b_set is new generic_set(<>); > with function a_to_b(A : in a_set.element) return > > b_set.element; > function a_set_to_b_set(the_set : in a_set.set) return b_set.set; > > > private > type Set is access Set_record; > type Set_record is record > El : Element; > Others_Els : Set; > end record; > end Generic_Set; > ======================================================= > > Sami Evangelista The code, as you've written it, is illegal. Within the declarative region of Generic_Set, if you use the name Generic_Set, it denotes the *current* *instance* of the generic, rather than the generic itself. Thus, since Generic_Set doesn't denote a generic in this context, it can't be used where a generic is expected in this formal package declaration: with package a_set is new generic_set(<>); See 8.6(18), 12.1(11). -- Adam