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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,760a0492b97ae06e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-21 05:37:13 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!dialin-145-254-037-037.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: How to test object hierarchy Date: Sun, 21 Dec 2003 14:43:27 +0100 Organization: At home Message-ID: References: <93172edb.0312181024.9a536b2@posting.google.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-037-037.arcor-ip.net (145.254.37.37) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.uni-berlin.de 1072013832 9905610 145.254.37.37 ([77047]) User-Agent: KNode/0.7.2 Xref: archiver1.google.com comp.lang.ada:3664 Date: 2003-12-21T14:43:27+01:00 List-Id: Georg Bauhaus wrote: > Dmitry A. Kazakov wrote: > : > :> should "with type" be mentioned in this context? > : > : Interesting, why do you thing it should? > > I'm not really familiar with "with type", but I thought (guessed) > that the OP's procedure could be distributed across pairs of two, > each procedure taking one top level class-wide parameter and > a derived type parameter. If I have > > package D is > > type Root is tagged private; > > type Derived_1 is new Root with private; > > procedure Op_1(d: Derived_1; other: Derived_2'Class); > -- too early > procedure Op_1(d: Derived_2; other: Derived_2'Class); > -- too early, too early > > type Derived_2 is new Root with private; > > procedure Op_2(d: Derived_2; other: Derived_1'Class); > procedure Op_2(d: Derived_1; other: Derived_1'Class); > -- too late > > ... > > Will "with type" and package reorganisation help? I think that IF Ada should have multiple dispatch on different types then inevitably we should reconsider the freezing rules. The most useful implementations of MD appear when types are defined in different packages. The rationale behind the existing freezing rules is to prevent dispatching to non-elaborated targets. I believe that for a MD operation the freezing point could be the last freezing point of all involved types. For example: package Devices is type Device is tagged ...; procedure Load (X : in out Device); end Device; -- No more primitive operations with only Device with Devices; use Devices; package Curves is type Curve is tagged ...; procedure Show (X : in out Device; Y : Curve); end Curves; -- No more operations with Device and Curve It is clear that these rules can be very dangerous, if we will not limit use of non-primitive operations (except the class-wide ones). The first step could be to make all types "tagged". But even this could be not enough. -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de