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, T_FILL_THIS_FORM_SHORT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4f325eb9bb392b2f X-Google-Attributes: gid103376,public From: Simon Wright Subject: Re: Delegating operations to parent (generic formal type) Date: 2000/08/28 Message-ID: #1/1 X-Deja-AN: 663553183 X-NNTP-Posting-Host: pogner.demon.co.uk:158.152.70.98 References: X-Trace: news.demon.co.uk 967484036 nnrp-03:12108 NO-IDENT pogner.demon.co.uk:158.152.70.98 Organization: At Home Newsgroups: comp.lang.ada X-Complaints-To: abuse@demon.net Date: 2000-08-28T00:00:00+00:00 List-Id: (This is a repost, in the hope someone can help!!) The code below is accepted by GNAT (3.13a1, 3.12p at least) but not by APEX 3.2.0b (Solaris) or the OA special edition (7.2). The problem arises in the body of Containers.Maps.Synchronized. APEX says it can't resolve the call Initialize (Map_Base (M)) in Containers.Maps.Synchronized.Initialize. OA ditto, followed by a fatal assertion error (or was it a bad memory access?) in the instantiation. This is a pretty common idiom in Smalltalk (super bind, super initialize) -- is there an Ada equivalent that would help here? I can't see why the compilers don't see the Initialize(Map_Base) operation, we're in a child package and should be able to see the private operations of Map_Base -- which include those of Controlled. ============================================================================= with Ada.Finalization; package Containers is type Container is abstract tagged private; private type Container is abstract new Ada.Finalization.Controlled with null record; end Containers; package Containers.Maps is type Map is abstract new Container with private; procedure Bind (M : in out Map) is abstract; private type Map is abstract new Container with null record; end Containers.Maps; package Containers.Maps.Unbounded is type Unbounded_Map is new Map with private; procedure Bind (M : in out Unbounded_Map); private type Unbounded_Map is new Map with null record; procedure Initialize (M : in out Unbounded_Map); end Containers.Maps.Unbounded; package body Containers.Maps.Unbounded is procedure Bind (M : in out Unbounded_Map) is begin null; end Bind; procedure Initialize (M : in out Unbounded_Map) is begin null; end Initialize; end Containers.Maps.Unbounded; generic type Map_Base is new Containers.Maps.Map with private; package Containers.Maps.Synchronized is type Synchronized_Map is new Map_Base with private; procedure Bind (M : in out Synchronized_Map); private type Synchronized_Map is new Map_Base with null record; procedure Initialize (M : in out Synchronized_Map); end Containers.Maps.Synchronized; package body Containers.Maps.Synchronized is procedure Bind (M : in out Synchronized_Map) is begin Bind (Map_Base (M)); -- this is OK in APEX end Bind; procedure Initialize (M : in out Synchronized_Map) is begin Initialize (Map_Base (M)); -- this is complained about end Initialize; end Containers.Maps.Synchronized; with Containers.Maps.Synchronized; with Containers.Maps.Unbounded; package User is package Synchronized_Unbounded_Map is new Containers.Maps.Synchronized (Map_Base => Containers.Maps.Unbounded.Unbounded_Map); end User;