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: "Kevin J. Weise" Subject: Re: "use" clauses and Ada 95 OOP Date: 1996/07/23 Message-ID: <4t2qib$f0o@michp1.redstone.army.mil>#1/1 X-Deja-AN: 169681983 references: content-type: text/plain; charset=us-ascii organization: Redstone Arsenal, Alabama mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 1.22 (Windows; I; 16bit) Date: 1996-07-23T00:00:00+00:00 List-Id: mg@asp.camb.inmet.com (Mitch Gart) wrote: > >But my point is that a naive Ada 95 reader might think that the call > > pkg1.func(x) > >calls the code that is in the body of pkg1. The syntax in fact >implies that strongly. To know it's not true a reader has to look >at the spec of pkg1 and figure out that x is a tagged type and >func is a primitive operation on a variable or anonymous access >type, in order to know that the call is dispatching. > (My note: original example involved Java syntax and semantics, which I don't know, but which I am assuming will be sufficiently similar to C++) What about the point that a naive C++ reader might think that the call x.func calls the code that is in the class of x (say, class X). The syntax, in fact, implies that strongly. To know its not true, the reader has to look at the public part of class X and figure out that it inherits class Y (and maybe even more classes), then look at the public part of class Y (& other inherited classes), and then the classes that those classes inherit, and so on, until it finds the class in which the function is introduced. Does not Java class syntax & semantics behave in the same (or similar) fashion? > In Ada 95 OOP we can have the situation where a call > > pkg1.func(x) > > dispatches at runtime to > > pkg2.func(x) > > It seems to me that this notation is misleading because a > reader might think that the function in pkg1 will be executed. > Unless I'm seriously missing something here, the function in pkg1 will be executed if in fact there *is* one in pkg1. If there isn't, and the user doesn't have detailed knowledge of the derivation of x, then the user has to go looking for where func actually is defined. I see no real difference between this and the class-based model. > >The choice is between giving the reader less information, versus >giving him misleading information. > >- Mitch Indeed, it is misleading only to someone who doesn't bother to find out what the syntax & semantics are, & relate it to what s/he already knows in other languages. --------------------------------------------------------------------- Kevin J. Weise email: kweise@sed.redstone.army.mil COLSA Corp. voice: (205) 842-9083 Huntsville, AL .. standard disclaimers apply