From: Simon Wright <simon@pogner.demon.co.uk>
Subject: Delegating operations to parent (generic formal type)
Date: 2000/07/13
Date: 2000-07-13T00:00:00+00:00 [thread overview]
Message-ID: <x7vem4xvjtz.fsf@pogner.demon.co.uk> (raw)
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;
next reply other threads:[~2000-07-13 0:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-07-13 0:00 Simon Wright [this message]
2000-07-13 0:00 ` Delegating operations to parent (generic formal type) tmoran
2000-07-14 0:00 ` Simon Wright
2000-07-14 0:00 ` Simon Wright
2000-07-15 0:00 ` Simon Wright
2000-08-28 0:00 ` Simon Wright
2000-08-29 0:00 ` Tucker Taft
2000-09-06 5:25 ` Simon Wright
2000-09-07 21:56 ` Tucker Taft
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox