From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9cfa83146b0781ed X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-11-16 04:02:38 PST Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!swrinde!news.uh.edu!uuneo.neosoft.com!Starbase.NeoSoft.COM!not-for-mail From: dweller@Starbase.NeoSoft.COM (David Weller) Newsgroups: comp.lang.ada Subject: Re: Overloading for T and T'Class Date: 16 Nov 1994 05:59:34 -0600 Organization: NeoSoft Internet Services +1 713 684 5969 Message-ID: <3acs76$6gi@Starbase.NeoSoft.COM> References: NNTP-Posting-Host: starbase.neosoft.com Date: 1994-11-16T05:59:34-06:00 List-Id: In article , John Volan 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.