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,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,42e1651b277d99e,start X-Google-Attributes: gid103376,public From: dennison@telepath.com Subject: Extensions in generic bodies - Language Laywer question Date: 1998/10/08 Message-ID: <6vijho$qps$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 398993328 X-Http-Proxy: 1.0 x6.dejanews.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Thu Oct 08 14:51:36 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.05 [en] (WinNT; I) Date: 1998-10-08T00:00:00+00:00 List-Id: Here's one for the langauge Laywers. 3.9.1(4) says: "A type extension shall not be declared in a generic body if the parent type is declared outside that body. " Does that also go for instantiating generics that *cause* a type extension? My compiler seems to think so. My situation: I'm trying to create a generic object. Internally (In the body) I want to keep a queue of these objects. I figure I'll use the Ada95 Booch-components. So in my generic's body I'm instantiating a Booch-Component container with the object that my generic was instantiated with. However, BC.Containers contains a type extension in its private section. So when I compile my generic's body, my compiler blows up at the line of my instantiation of BC.Containers parroting LRM:3.9.1(4) and also pointing to the type extension in BC.Containers. generic type Object is private; package Interface_Object is . . . end Interface Object; with BC.Containers; package body Interface_Object is type Object_Ptr is access all Object; package Object_Container is new BC.Containers (Item => Object, Item_Ptr => Object_Ptr); package Object_Queue is new Object_Container.Queues.Bounded (Maximum_Size => 10, Bnd_Queue_Nodes => Object_Container); . . . end Interface_Object; Compiling 'Interface_Object.adb': Thu Oct 08 09:47:13 1998 interface_object.adb: Error: line 7 col 30 LRM:3.9.1(4), A type extension may not be declared in a generic body if the parent type is declared outside that body; this applies to the visible part of a generic instantiation (In instance of generic Containers at bc-containers.ads: line 47 col 10) -- T.E.D. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own