Re: Interfaces and private types
- From: "Randy Brukardt" <randy@xxxxxxxxxxxxxx>
- Date: Mon, 28 Jan 2008 16:58:25 -0600
"Philippe Tarroux" <philippe.tarroux@xxxxxxxx> wrote in message
news:fnl2in$k49$1@xxxxxxxxxxxxxxxxxx
Hi again,
There is no compilation problem with the following code :
package Test_Interfaces is
type Int is synchronized interface;
procedure Init (I : in out Int) is abstract;
type T is new Int with private;
private
task type T is
entry Init;
end T;
end Test_Interfaces;
As written, this is illegal because type T does not have the interface Int.
Specifically, it violates 7.3(7.3/2): "the partial view shall be a
descendant of an interface type (see 3.9.4) if and only if the full type is
a descendant of the interface type."
Assuming that this is just a mistake in your interface and you meant
task type T is new Int with
then your program is legal, and you should complain your your compiler
vendor about the bug. In no case should there be an error on the declaration
of the object, so that makes it pretty clear that there is a compiler bug.
You could work around the bug with something like:
package Test_Interfaces is
type Int is synchronized interface;
procedure Init (I : in out Int) is abstract;
type T is new Int with private;
overriding procedure Init (I : in out T);
private
task type T is new Int with
entry Init;
end T;
end Test_Interfaces;
and then have
procedure Init (I : in out T) is
begin
I.Init;
end Init;
in the body. (But note that this runs into a known bug in the Ada standard,
so it isn't clear that the code will work right.)
Randy.
.
- Follow-Ups:
- Re: Interfaces and private types
- From: Philippe Tarroux
- Re: Interfaces and private types
- References:
- Interfaces and private types
- From: Philippe Tarroux
- Interfaces and private types
- Prev by Date: Re: Allocators and memory reclamation
- Next by Date: Re: Allocators and memory reclamation
- Previous by thread: Re: Interfaces and private types
- Next by thread: Re: Interfaces and private types
- Index(es):
Relevant Pages
|