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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3ccb707f4c91a5f2 X-Google-Attributes: gid103376,public From: "Norman H. Cohen" Subject: Re: Once again, Ada absent from DoD SBIR solicitation Date: 1996/10/14 Message-ID: <3262572D.4E79@watson.ibm.com>#1/1 X-Deja-AN: 189332437 references: <325D40E0.41C6@hso.link.com> content-type: text/plain; charset=us-ascii organization: IBM Thomas J. Watson Research Center mime-version: 1.0 reply-to: ncohen@watson.ibm.com newsgroups: comp.lang.ada x-mailer: Mozilla 3.0 (Win95; I) Date: 1996-10-14T00:00:00+00:00 List-Id: Mitch Gart wrote: > Ada package notation makes it worse: > > pkg1.func(obj, param); > > can really call the code in the body of pkg2, instead of pkg1, if there is > dispatching. To me in this case the Ada syntax is lying to the person who > is reading the program. It makes the code hard to read correctly in my opinion. This is the wrong way to think about it. pkg1.func, called with a classwide argument, is a polymorphic subprogram that is introduced in pkg1. The dispatching is part of the implementation of the polymorphic subprogram, not part of its interface. When manipulating an object through a classwide view, one should, in most circumstances, not be concerned with the specific type of the object. From the caller's level of abstraction, a dispatching call on pkg1.func is invoking the polymorphic interface declared in pkg1. The fact that the polymorphic behavior may implemented by dispatching to a body in pkg2 should be irrelevant to the caller. A comment in pkg1 should specify the behavior of func in general terms that will apply to all future overridings of func. That is, when func is overridden, the overriding subprogram should satisfy the specifications of pkg1.func (and possibly additional specifications as well). When calling pkg1.func, the caller should rely only on the more general specifications that apply to pkg1.func and ALL its overridings. -- Norman H. Cohen mailto:ncohen@watson.ibm.com http://www.research.ibm.com/people/n/ncohen