From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Problem with controlled types
Date: 1998/12/14
Date: 1998-12-14T00:00:00+00:00 [thread overview]
Message-ID: <EACHUS.98Dec14183231@spectre.mitre.org> (raw)
In-Reply-To: F3z2s2.6CG.0.-s@inmet.camb.inmet.com
In article <F3z2s2.6CG.0.-s@inmet.camb.inmet.com> stt@houdini.camb.inmet.com (Tucker Taft) writes:
> Not quite true. The problem is that *inside* the package private
> part and the body, Get_B is primitive on two tagged types,
> and that is not legal.
> So ObjectAda wins this round ;-).
Interesting. Try the following example:
generic
type Out_Type is private;
type In_Type is new Out_Type;
function Conversion(I: In_Type) return Out_Type;
with Ada.Finalization; with Conversion;
package Pkg is
type A is private;
package Inner is
type B is private;
function Convert is new Conversion(A,B);
-- I'd use Ada.Unchecked_Conversion but that has convention Intrinsic.
private
type B is new Ada.Finalization.Controlled with record
...
end record;
end Inner;
private
type A is new Ada.Finalization.Controlled with record
...
end record;
end Pkg;
Now according to Tucker, in the private part of Pkg, Convert is a
dispatching operation of A, and in the private part of Inner, it is a
dispatching operation of B. As written there is no body allowed so
the example is legal. I could add types C and D and other generic
instantiations to play futher with this.
I don't think I like either interpretation of 3.9.2(12).
Seriously, 3.9.2(12) says: "A given subprogram shall not be a
dispatching operation of two or more distinct tagged types." It
doesn't say of two visibly tagged types, so I think my example would
also be illegal.
--
Robert I. Eachus
with Standard_Disclaimer;
use Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...
next prev parent reply other threads:[~1998-12-14 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-12-14 0:00 Problem with controlled types bourguet
1998-12-14 0:00 ` Robert A Duff
1998-12-14 0:00 ` Matthew Heaney
1998-12-14 0:00 ` Tucker Taft
1998-12-14 0:00 ` Robert I. Eachus [this message]
1998-12-14 0:00 ` Tom Moran
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox