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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d534ff88bae65c48 X-Google-Attributes: gid103376,public From: "Robert I. Eachus" Subject: Re: hunting snarks Date: 1999/12/21 Message-ID: <385FF7BF.864DE1E8@mitre.org>#1/1 X-Deja-AN: 563552447 Content-Transfer-Encoding: 7bit References: <3856A48D.F4AF4D84@averstar.com> <385E8D68.D902D2A4@averstar.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.mitre.org X-Trace: top.mitre.org 945813024 19569 129.83.41.77 (21 Dec 1999 21:50:24 GMT) Organization: The MITRE Corporation Mime-Version: 1.0 NNTP-Posting-Date: 21 Dec 1999 21:50:24 GMT Newsgroups: comp.lang.ada Date: 1999-12-21T21:50:24+00:00 List-Id: Tucker Taft wrote: > When defining a generic "mix-in" it is quite reasonable to > have an operation that overrides an inherited operation. It is > also just as reasonable to be creating a new operation. It really > requires knowledge of the particular instantiation in some cases, > and clearly you don't have that knowledge when writing the > generic itself. So that is what this pragma is used for. > The pragma is not to be read as "allow accidental overriding" but rather > as "allow intentional overriding upon instantiation." There is another idiom where you extend an (abstract) type using several instantiation, and then export the final result as a concete type. When using this to extend a type by adding both operations and state/data fields. It can be the case that some extentions have similar profiles, and thus override, but neither the author of the mix-in or the user cares. (From the user's viewpoint, the (actually overridden) operations are overloaded, and require qualification or renaming, while from the author's viewpoint, he cannot see and never cares about the other inherited operations. Sound complex? It isn't, and actually allows a classical abstract type to be constructed from many components. Due to the way generics/templates work, you have three levels of abstraction. The user and the component author see a single level, and the creator of the abstract type deals only with explicit interactions required by the design. There are no implicit interactions to trip him up. > For anyone instantiating the generic, this is presumably a > flag to indicate that some additional care may be required here. > Without the pragma, you might be forced to create two versions > of the same generic, one with a pragma Overrides, and one without, > which definitely seems like overkill in some situations. And an invitation to a combinatorial explosion. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...