comp.lang.ada
 help / color / mirror / Atom feed
From: dgibson@snoopy.cis.ohio-state.edu (david scott gibson)
Subject: Re: Q: on redefinition of "=
Date: 1996/04/01
Date: 1996-04-01T00:00:00+00:00	[thread overview]
Message-ID: <4joui6INNqej@snoopy.cis.ohio-state.edu> (raw)
In-Reply-To: Dp6q2B.Ay4@world.std.com

In article <Dp6q2B.Ay4@world.std.com>,
Robert A Duff <bobduff@world.std.com> wrote:
>In article <4jkj5sINN8d3@aleutian.cis.ohio-state.edu>,
>david scott gibson <dgibson@aleutian.cis.ohio-state.edu> wrote:
>>Hi.  I'm overloading the = operation to return a non-boolean value for
>>a non-limited private type.  Is there any way in Ada95 to "hide" the
>>automatically defined = returning a boolean value?  Redefining =
>>returning a boolean type in the private section didn't seem to help.
>
>function "="(X, Y: My_Type) return Boolean is abstract;
>
>This overrides the predefined "=" with an abstract version.
>It's illegal to call this abstract version, since calls to
>abstract function have to be dispatching calls, and there are
>no tagged operands, so there's no way to write a dispatching call.
>(I'm assuming My_Type is not tagged, here.)

Thanks for the suggestion.  However, I should have mentioned that the
type for which I'm redefining equality (My_Type above) is indeed a
tagged type.  According to RM3.9.3(3), I believe I can only define an
abstract subprogram as a primitive operation of a tagged type if the
taggged type itself is abstract.  Thus this strategy doesn't seem to
work.  Admittedly what I'm trying to do is a bit strange, but I
thought the rules for redefining the equality operator were intended
to make something like this possible.  Perhaps this sort of thing was
only intended for limited types.   Any other ideas anyone?

Dave








  reply	other threads:[~1996-04-01  0:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-30  0:00 Q: on redefinition of "= david scott gibson
1996-04-01  0:00 ` Robert A Duff
1996-04-01  0:00   ` david scott gibson [this message]
1996-04-01  0:00     ` Robert A Duff
1996-04-01  0:00 ` Tucker Taft
1996-04-01  0:00   ` david scott gibson
1996-04-01  0:00     ` Robert Dewar
1996-04-02  0:00       ` Mike Young
1996-04-02  0:00         ` Robert Dewar
1996-04-02  0:00           ` david scott gibson
1996-04-02  0:00             ` Robert Dewar
1996-04-02  0:00             ` Robert A Duff
1996-04-02  0:00               ` david scott gibson
1996-04-02  0:00                 ` Robert A Duff
1996-04-02  0:00                   ` david scott gibson
1996-04-03  0:00             ` 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