From: Rod Chapman <rod@praxis-cs.co.uk>
Subject: Operator visibility/inheritance for derived private type? (Repost)
Date: 2000/01/27
Date: 2000-01-27T00:00:00+00:00 [thread overview]
Message-ID: <38905ACA.B406AA72@praxis-cs.co.uk> (raw)
Confused of Bath writes:
Imagine I have a package exporting a private type with an
explicitly redeclared "=" operator - Ada.Task_Identification.Task_ID
for instance. I want to derive another private type from
this, exporting only a subset of the operations of the original,
so I write
with Ada.Task_Identification;
package Rod.TI is
type Task_ID is private;
function Current_Task return Boolean;
private
type Task_ID is new Ada.Task_Identification.Task_ID;
end Rod.TI;
If a user of this package does
A, B : Rod.TI.Task_ID;
begin
if A = B then ...
which "=" is called? Do I get some simple comparison of
A and B or should I get a call of
Ada.Task_Identification."="?
GNAT (3.12a3 on NT) seems to be generating the former,
but I'm not sure if the language requires the latter,
and GNAT is simply doing an optimisation. If
I _definintely_ want the call to Ada.Task_Identification."=",
so I need to explicitly redeclare my own "=" for
Rod.TI.Task_ID? Which language rule(s)
am I missing to explain what going on?
Cheers,
Rod Chapman
Praxis Critical Systems
next reply other threads:[~2000-01-27 0:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-01-27 0:00 Rod Chapman [this message]
2000-01-28 0:00 ` Operator visibility/inheritance for derived private type? (Repost) 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