comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Overloading for T and T'Class
Date: 16 Nov 94 11:33:36
Date: 1994-11-16T11:33:36+00:00	[thread overview]
Message-ID: <EACHUS.94Nov16113336@spectre.mitre.org> (raw)
In-Reply-To: bobduff@dsd.camb.inmet.com's message of Tue, 15 Nov 1994 02:22:18 GMT

In article <CzAEL6.1w0@inmet.camb.inmet.com> bobduff@dsd.camb.inmet.com (Bob Duff) writes:

  > >In Ada9X, is it legal to overload the same subprogram name for both
  > >some tagged type T and its class-wide type T'Class?  For example:

  > Yes, but not particularly useful.

    There is one use, and I have actually used a similar Ada 83 trick.
If you want to delete an operation that makes sense for the parent,
you can use such explicit overloading to hide the operation forever.

    The near equivalent Ada 83 trick is to have two declarations, one
of which has an additional parameter with a default.  The only way to
access the version with fewer parameters is by renaming it.  This can
be used to replace an inherited operation with one that conveys
additional necessary information.  (And of course any call which uses
the default is ambiguous, so the interface is a little misleading.
But you can add a comment to the declaration.)
--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...



  reply	other threads:[~1994-11-16 11:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-11-11 21:33 Overloading for T and T'Class John Volan
1994-11-14  2:07 ` David Weller
1994-11-15  5:01   ` Cyrille Comar
1994-11-15  2:22 ` Bob Duff
1994-11-16 11:33   ` Robert I. Eachus [this message]
     [not found] ` <3a6goo$j7s@starbase.neosoft.com>
1994-11-15  2:35   ` Tucker Taft
1994-11-15 11:39     ` David Weller
1994-11-16  4:32       ` Brad Balfour
1994-11-16 14:34         ` John Volan
1994-11-15 14:15     ` Norman H. Cohen
1994-11-16  1:22 ` John Volan
1994-11-16 11:59   ` David Weller
1994-11-19  4:54   ` Cyrille Comar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox