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: "James A. Squire" Subject: Re: "use" clauses and Ada 95 OOP Date: 1996/07/20 Message-ID: <31F170FC.672C@csehp3.mdc.com>#1/1 X-Deja-AN: 169351932 sender: Ada programming language references: comments: Gated by NETNEWS@AUVM.AMERICAN.EDU content-type: text/plain; charset=us-ascii organization: MDA Avionics Tools & Processes mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.01 (X11; I; HP-UX A.09.01 9000/715) Date: 1996-07-20T00:00:00+00:00 List-Id: Robert I. Eachus wrote: > > In article mg@asp.camb.inmet.com (Mitch > Gart) writes: > > > It seems to me that this notation is misleading because a reader might > > think that the function in pkg1 will be executed. > > > Therefore with tagged types I have adopted the style of always using > > "use" clauses and writing the call > > > func(x); > > > in the source code. This seems less misleading to me. I never used to > > use "use" clauses in Ada 83 but I now use them a lot in Ada 95 when > > calling dispatching operations. > > > Have other people adopted this style? Comments? People who have written > > coding standards which say "don't use 'use' clauses", do you think this > > rule is still a good idea with Ada 95 dispatching? > > My rule is to always "use type" dispatching types. The names you > no longer have to qualify are the ones where the qualification would > be misleading. 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", etc.), I'm not so sure. For example, I would have a coding style rule that says that all dispatching calls must be properly annotated so that a maintainer knows what is going on. How does a code reviewer enforce such a rule if the developer forgot to annotate it? How does he tell that the call is a dispatching call in a normal piece of complex application code (i.e., this is no "Hello World" we're talking about here)? -- James Squire mailto:ja_squire@csehp3.mdc.com MDA Avionics Tools & Processes McDonnell Douglas Aerospace http://www.mdc.com/ Opinions expressed here are my own and NOT my company's "Commander, it's not your decision. We're going. What are you going to do, shoot us down?" 'If that's what's required to protect this station, yes.' "Excuse me?" -- Captain Pierce and Sinclair, "A Voice in the Wilderness II"