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,ad62d6b425bebfec X-Google-Attributes: gid103376,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: "use" clauses and Ada 95 OOP Date: 1996/07/23 Message-ID: #1/1 X-Deja-AN: 169772275 references: organization: The Mitre Corp., Bedford, MA. newsgroups: comp.lang.ada Date: 1996-07-23T00:00:00+00:00 List-Id: In article <31F170FC.672C@csehp3.mdc.com> "James A. Squire" wrote: > Very interesting! Let me see if I'm reading you right: > 1. func would have to be a primitive operation in order to be a > dispatching call. Right? > 2. Therefore, func would be covered by the "use type" clause on > , right? > I liked the idea of "use type" when I thought it only referred to > implicit operations like "&", "+", "=" (operations that I wish the Ada > designers had made a part of the language proper so we wouldn't have any > need for the use clause). Now that it seems "use type" applies to all > primitive operations (some of which are user-written, like "Handle", In article jsa@alexandria (Jon S Anthony) writes: > A use_type clause only gives "direct" visibility to primitive _operators_ > of the type: RM 8.4(8). The reality is somewhere in the middle. RM 3.2.3(8): "A primitive subprogram whose designator is an operator_symbol is called a _primitive_operator_." RM 3.2.3(1): "The _primitive_operations of a type are the predefined operations of the type, plus any user-defined primitive subprograms." So yes, this "trick" only works for 21 specific names. But there are lots of cases where using these symbols (including and, or, xor, "&", mod, rem, abs, not) make lots of sense for abstract data types. For example, take a set abstraction. All but two operations (Is_Empty and Empty) are best defined as Ada operators. (Note also that function "+"(L: Set; R: Element) return Set; can be a primitive operator of either Set or Element depending on where it is defined.) -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...