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 10:54:44 PST Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!gatech!bloom-beacon.mit.edu!news.kei.com!eff!blanket.mitre.org!linus.mitre.org!linus!mbunix!eachus From: eachus@spectre.mitre.org (Robert I. Eachus) Newsgroups: comp.lang.ada Subject: Re: Overloading for T and T'Class Date: 16 Nov 94 11:33:36 Organization: The Mitre Corp., Bedford, MA. Message-ID: References: NNTP-Posting-Host: spectre.mitre.org In-reply-to: bobduff@dsd.camb.inmet.com's message of Tue, 15 Nov 1994 02:22:18 GMT Date: 1994-11-16T11:33:36+00:00 List-Id: In article 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...