comp.lang.ada
 help / color / mirror / Atom feed
From: stt@houdini.camb.inmet.com (Tucker Taft)
Subject: Re: Problem with controlled types
Date: 1998/12/14
Date: 1998-12-14T00:00:00+00:00	[thread overview]
Message-ID: <F3z2s2.6CG.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: m367beshjr.fsf@mheaney.ni.net

Matthew Heaney (matthew_heaney@acm.org) wrote:
: bourguet@my-dejanews.com writes:

: > with ada.finalization;
: > 
: > package Pkg is
: > 
: >    type A is private;
: >    --  operations on B
: > 
: >    type B is private;
: > 
: >    function Get_B (I: A) return B;
: >    -- other operations on B
: > 
: > private
: > 
: >   type A is new Ada.Finalization.Controlled with record
: >      ...
: >   end record;
: > 
: >   type B is new Ada.Finalization.Controlled with record
: >      ...
: >   end record;
: > 
: > end pkg;
: > 
: > ObjectAda complain that the Get_B function is primitive on two tagged
: > types, and that is not allowed.
: > 
: > Gnat compile and run correctly (as A'Class contains only A and
: > B'Class only B, this is not strange).
: > 
: > Now, which one is correct?

: GNAT is correct; ObjectAda is incorrect.

: An operation cannot be primitive for more that one type is only true for
: (publicly) tagged types.  Since A and B and not publically tagged,
: Get_B is a legal operation.

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 ;-).

--
-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA
An AverStar Company




  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 [this message]
1998-12-14  0:00     ` Robert I. Eachus
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