From: adam@irvine.com
Subject: Question about generic formal derived types
Date: 1999/03/30
Date: 1999-03-30T00:00:00+00:00 [thread overview]
Message-ID: <7dpgl4$h2j$1@nnrp1.dejanews.com> (raw)
In this program fragment:
-------------------------------------------------------------------------------
package Pack1 is
type Root_Type is tagged record
Field1 : Integer;
Field2 : Boolean;
end record;
end Pack1;
with Pack1;
generic
type Formal_Type is new Pack1.Root_Type with private;
package Pack2 is
type New_Type is new Formal_Type with record
Field3 : Character;
end record;
end Pack2;
with Pack1;
package Pack3 is
type Root_Type_Extension is new Pack1.Root_Type with record
Field3 : Float;
end record;
end Pack3;
. . .
with Pack2;
with Pack3;
package body Pack4 is
package Instantiation is new Pack2 (Pack3.Root_Type_Extension);
procedure Inner is
X : Character;
Y : Instantiation.New_Type;
begin
X := Y.Field3;
end Inner;
end Pack4;
-------------------------------------------------------------------------------
I can't believe that a record type can have two components of the same name,
but it appears that Instantiation.New_Type would have two components named
Field3.
When Y.Field3 is accessed, which Field3 is meant?
Which language rules in the RM govern this situation?
-- thanks, Adam
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
next reply other threads:[~1999-03-30 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-30 0:00 adam [this message]
1999-03-30 0:00 ` Question about generic formal derived types Steve Quinlan
1999-03-30 0:00 ` Stephen Leake
1999-03-30 0:00 ` adam
1999-03-31 0:00 ` Stephen Leake
1999-03-31 0:00 ` robert_dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox