From dismukes@gnat.com Thu Mar 28 02:35:49 1996 Return-Path: Received: from inmet.camb.inmet.com by dsd.camb.inmet.com (4.1/SMI-4.1) id AA22130; Thu, 28 Mar 96 02:35:49 EST Received: from sw-eng.falls-church.va.us (ns1.sw-eng.falls-church.va.us) by inmet.camb.inmet.com (4.1/SMI-4.1) id AA02547; Thu, 28 Mar 96 02:36:03 EST Received: from nile.gnat.com by sw-eng.falls-church.va.us (8.7.1/) id HAA22413; Thu, 28 Mar 1996 07:35:18 GMT Received: by nile.gnat.com (5.0/1.20) id AA19736; Thu, 28 Mar 96 02:34:40 EST Date: Thu, 28 Mar 96 02:34:40 EST From: dismukes@gnat.com (Gary Dismukes) Message-Id: <9603280734.AA19736@nile.gnat.com> To: ada-comment@sw-eng.falls-church.va.us Subject: Re: When does a private extension inherit known discriminants? Cc: dismukes@gnat.com !topic When does a private extension inherit known discriminants from its ancestor? !reference RM95-7.3(10) !reference 96-5451.c Pascal Leroy 96-3-27 !from Gary Dismukes 96-03-28 <> !discussion > Consider the following code fragment. Is the constraint in the full > declaration of type Child.T legal? I believe it's legal. > package Parent is > type T (<>) is tagged private; > private > type T (D : Integer) is tagged null record; > end Parent; > > package Parent.Child is > type T is new Parent.T with private; > private > type T is new Parent.T (D => 3) with null record; -- legal? > end Parent.Child; > > The issue has to do with RM95 7.3(10) which says: "if a private extension > inherits known discriminants from the ancestor subtype, then the full view > shall also inherit its discriminants from the ancestor subtype, and the parent > subtype of the full view shall be constrained iff the ancestor subtype is > constrained." > > Does the private extension Child.T inherit known discriminants from the > ancestor subtype? The answer seems to depend on whether we ask this question > on the partial view or on the full view. The private extension inherits unknown discriminants from the partial view of Parent.T (which is the only view of Parent.T visible to the private extension). > If the answer to this question is yes, then 7.3(10) applies, and the > constraint is illegal. If the answer is no, then 7.3(10) is irrelevant and the > constraint is legal. The rule doesn't apply as far as I can see since the private extension doesn't inherit known discriminants. -- Gary Dismukes