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,e0bc6f4c0c1f6e5e X-Google-Attributes: gid103376,public From: stt@houdini.camb.inmet.com (Tucker Taft) Subject: Re: Help on extending a private record from a private record with a generic attribute... Date: 1998/04/16 Message-ID: #1/1 X-Deja-AN: 344801761 Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.camb.inmet.com References: <35364E81.94B51B0F@amherst.com> Organization: Intermetrics, Inc. Newsgroups: comp.lang.ada Date: 1998-04-16T00:00:00+00:00 List-Id: Christopher Campise (crc@amherst.com) wrote: : Ada95 on a Rational Apex compiler: : I have a "superclass" with a private record consisiting of a generic : type attribute. I need to inherit this from within another package but : am receiving compiler errors stating that "a record extension will be : provided iff the parent record is tagged," (which it is). Is this even : legal? I looked everywhere for examples and found none that relate to : this, adahome.com, Programming in Ada95, Rendezvous with Ada95, plus : other tutorials. Any ideas? You cannot select items from a generic package. You must first instantiate the generic package, and select items from the instance. : For example: : *********** : generic : type Value_Class is private; : package Generic is : type Class is tagged private; : . : . : private : type Class is tagged : record : Some_Value : Value_Class; : end record; : end Generic; I presume you didn't really call it "Generic" since that is an Ada reserved word... : *********** : with Generic; : package MyPackage is : type Class is new Generic.Class with private; -> Message: "CLASS : (2nd one) denotes no component of Generic; a record extension : will be provided iff parent type is a tagged type" (which it is) This message is misleading you. The problem is that "Generic" is a generic package, rather than a (non-generic) package. You cannot select anything from a generic package. You need something like: with Generic; package Instance is new Generic(My_Value_Class); and then refer to Instance.Class. If you don't want to instantiate first, then you need to define a new generic which has a formal package, e.g.: with Generic; generic with package Instance is new Generic(<>); package MyPackage is type Class is new Instance.Class with private; ... : . : . : private : type Class is new Generic.Class with -> Message: "CLASS (2nd : one) denotes no component of Generic; a record extension : record : will be provided iff parent type is a tagged type" (which it is) Same problem. "Generic" is a generic, not an instance. : Index : Integer; : end record; : end MyPackage; : *********** : -- : Chris Campise, Associate Engineer phone: (716)631-0610 x384 : Amherst Systems Inc. fax: (716)631-0629 : 30 Wilson Road E-Mail: crc@amherst.com : Buffalo, NY 14221 WWW: www.amherst.com -- -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ Intermetrics, Inc. Burlington, MA USA