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,start X-Google-Attributes: gid103376,public From: mg@asp.camb.inmet.com (Mitch Gart) Subject: "use" clauses and Ada 95 OOP Date: 1996/07/17 Message-ID: #1/1 X-Deja-AN: 168620561 sender: news@inmet.camb.inmet.com (USENET news) x-nntp-posting-host: asp.camb.inmet.com organization: Intermetrics, Inc. newsgroups: comp.lang.ada Date: 1996-07-17T00:00:00+00:00 List-Id: In Ada 95 OOP we can have the situation where a call pkg1.func(x) dispatches at runtime to pkg2.func(x) because x is a classwide tagged type whose base type is in pkg1 but whose runtime tag says it's in fact a derived type in pkg2. 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? To me the C++/Java syntax x.func seems clearer than the Ada syntax in this case because what is being called is the function that is associated with X at runtime, rather than the function that comes from a given package. -- Mitch Gart -- mg@inmet.com