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,start X-Google-Attributes: gid103376,public From: Simon Wright Subject: Delegating operations to parent (generic formal type) Date: 2000/07/13 Message-ID: #1/1 X-Deja-AN: 646055491 X-NNTP-Posting-Host: pogner.demon.co.uk:158.152.70.98 X-Trace: news.demon.co.uk 963521063 nnrp-03:4396 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-07-13T00:00:00+00:00 List-Id: The code below is accepted by GNAT (3.13a1, 3.12p at least) but not by APEX 3.2.0b (Solaris) or the OA demo edition. 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 says the call to Bind (Map_Base (M)) is a non-dispatching call on an abstract subprogram. I think it may be confused, it mutters also about "internal error". This is a pretty common idiom in Smalltalk (super bind, super initialize) -- is there an Ada equivalent that would help here? I can believe that OA is wrong, it's very old now, but I can't see why APEX doesn't see the Initialize(Map_Base) operation. ============================================================================= 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;