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,3ccb707f4c91a5f2 X-Google-Attributes: gid103376,public From: kilgallen@eisner.decus.org (Larry Kilgallen) Subject: Re: Java vs Ada 95 (Was Re: Once again, Ada absent from DoD SBIR solicitation) Date: 1996/10/15 Message-ID: <1996Oct15.154148.1@eisner>#1/1 X-Deja-AN: 189728877 x-nntp-posting-host: eisner.decus.org references: x-nntp-posting-user: KILGALLEN x-trace: 845408515/9343 organization: LJK Software newsgroups: comp.lang.ada Date: 1996-10-15T00:00:00+00:00 List-Id: In article , mg@dsd.camb.inmet.com (Mitch Gart) writes: > Brian Rogoff (rogoff@sccm.Stanford.EDU) wrote: > : Besides GC, which is arguable, no one has > : listed any *language* advantages of Java over Ada. > > Calling superclass methods is easy in Java and hard in Ada: > > type parent_obj is tagged record ...; > type parent_ptr is access all parent_obj; > procedure p(param: access parent_obj); > > type child_obj is new parent_obj with ...; > type child_ptr is access all child_obj; > procedure p(param: access child_obj); > > now inside the child's p, to call the parent's p: > > p(parent_obj(param.all)'access); > > is the way to do it. Converting the pointer to parent_ptr won't work because > the call will dispatch back to the child. This ".all'access" trick is pretty > painful. In Java the keyword "super" does what's wanted: > > super.p(); > > Calling the parent type's operation is common in OOP and is painful to code, > and read, in Ada. Presuming a long body for the child, that Ada code potentially must be altered in many places if the immediate parent changes. At least the whole body of code must be inspected if the "quiesce" method is to invoke the "quiesce" method of the immediate parent, whatever that may be this month. Some have argued that one should not insert new generations without reviewing all such code, but for some orderly environments I claim it is quite reasonable to count on coding standards having been followed. Macintosh Object Pascal does this with an "inherited" keyword. Larry Kilgallen