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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9517e3cc3c7e4772 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-03 22:57:53 PST Path: nntp.gmd.de!Germany.EU.net!howland.reston.ans.net!agate!blanket.mitre.org!linus.mitre.org!spectre!eachus From: eachus@spectre.mitre.org (Robert I. Eachus) Newsgroups: comp.lang.ada Subject: Re: Overloading and polymorphism Date: 03 Jan 1995 20:41:56 GMT Organization: The Mitre Corp., Bedford, MA. Message-ID: References: <3dkf92$i0s@israel-info.datasrv.co.il> NNTP-Posting-Host: spectre.mitre.org In-reply-to: benari@zeus.datasrv.co.il's message of 25 Dec 1994 18:56:34 GMT Date: 1995-01-03T20:41:56+00:00 List-Id: In article <3dkf92$i0s@israel-info.datasrv.co.il> benari@zeus.datasrv.co.il (Moti Ben-Ari) writes: > Are there any similar problems in Ada 9X or does everything > work out OK because each call is dispatched on a tag? Most of the problems are avoided in Ada 9X, but mostly due to strong typing. In fact, in many cases in Ada 9X, calls which appear to be dispatching in the source code can be analyzed at compile time and the dispatch table bypassed. In the cases where this does not happen, if there is a possibility of a type violation, the langauge does specify run-time checking. (The freezing rules also help. Since a primitive subprogram declaration cannot occur after the type is frozen, dispatching operations, which must be primitive, must be declared relatively soon after the declaration of the type.) Having said all that it is still possible to create cases in Ada 9X where the dispatch is not to the "expected" routine. But in general you have to know a lot to create the problem cases, they don't happen by accident. (In fact I suspect that most of the cases are so obviously pathological that good compilers will generate warning messages--not for the call, but for the overloading. AFAIK, the problem only occurs when the scope of a dispatching subprogram does not match the scope of the type being dispatched on, and, yes, I realize that IS very hard to do.) -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...