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-14 22:15:34 PST Newsgroups: comp.lang.ada Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!news.sprintlink.net!hookup!news.mathworks.com!noc.near.net!inmet!dsd!bobduff From: bobduff@dsd.camb.inmet.com (Bob Duff) Subject: Re: Overloading for T and T'Class Message-ID: Sender: news@inmet.camb.inmet.com Organization: Intermetrics, Inc. References: Date: Tue, 15 Nov 1994 02:22:18 GMT Date: 1994-11-15T02:22:18+00:00 List-Id: In article , John Volan wrote: >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. > package P is > type T is tagged ... ; > procedure Op (X : in out T); > procedure Op (X : in out T'Class); > ... > end P; This is legal, but calls to Op will tend to be ambiguous. For example, if Y is of type T, then Op(Y) might mean either one of the Ops, and would therefore be ambiguous (and therefore illegal). We considered making the above declarations be homographs, and therefore illegal in the above case, but that caused some subtle semantic problems (I can't remember the details right now), so we decided to allow it. It's not necessary to make every useless thing illegal. Anyway, don't do it. ;-) - Bob -- Bob Duff bobduff@inmet.com Oak Tree Software, Inc. Ada 9X Mapping/Revision Team (Intermetrics, Inc.)