comp.lang.ada
 help / color / mirror / Atom feed
From: dweller@Starbase.NeoSoft.COM (David Weller)
Subject: Re: Overloading for T and T'Class
Date: 16 Nov 1994 05:59:34 -0600
Date: 1994-11-16T05:59:34-06:00	[thread overview]
Message-ID: <3acs76$6gi@Starbase.NeoSoft.COM> (raw)
In-Reply-To: CzC6Ho.Lqn@swlvx2.msd.ray.com

In article <CzC6Ho.Lqn@swlvx2.msd.ray.com>,
John Volan <jgv@swl.msd.ray.com> wrote:
>Thanks to those who sent me private e-mail on this.  Summarizing the
>responses so far: Yes, this does appear to be legal according to the
>current definition of Ada9X.  Apparently, T and T'Class are considered
>to be different types, even though the set of values of type T'Class
>"covers" the set of values of type T.  That's pretty much what I
>figured.
>
>The other half of my question was whether there was any rationale
>anyone could suggest for actually making use of this kind of
>overloading.  Personally, I haven't been able to come up with one.  On
>the basis of the ambiguous-invocation problem alone, I'd say that we'd
>probably want to avoid doing overloadings like these.  But does anyone
>else have any thoughts on this?
>

(Dave rubs hands gleefully)

Why, yes, John, there _is_ a use.  The Booch Components has the
ability to permit assignment and equality checks across each
hierarchy.  THat way, I can see if an Unbounded_Queue is structurally
equivalent to a Bounded_Queue.  Sooooo....  I create a top level type
declaration that is abstract:
	type Queue is abstract tagged private;
then an "=" operator:
	function "="(L, R : Queue'Class) return Boolean;
(There is an implicit declaration of:
	function "="(L, R : Queue) return Boolean;
when that classwide operation is declared)

Now, the point is that I can _never_ call the operation "=" for type
Queue (except perhaps inside the body of the package where Queue is
declared, and I can handle that).  

OK, that doesn't _quite_ answer your question, but it does suggest a
potential area for application.

I'd give a longer dissertation on this, but I'm still finishing up
slides for a presentation on the Booch Components for tonight.

-- 
Proud (and vocal) member of Team Ada! (and Team OS/2)        ||This is not your
   	      Ada -- Very Cool.  Doesn't Suck.               ||  father's Ada 
For all sorts of interesting Ada tidbits, run the command:   ||________________
"finger dweller@starbase.neosoft.com | more" (or e-mail with "finger" as subj.)
      Just another dull, stodgy, non-creative developer who uses Ada.



  reply	other threads:[~1994-11-16 11:59 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
     [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 [this message]
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