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: 1108a1,7a180be12347b9d3 X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,7a180be12347b9d3 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-16 04:08:40 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!pc2-clif3-0-cust11.not.cable.ntl.COM!not-for-mail From: brangdon@cix.co.uk (Dave Harris) Newsgroups: comp.lang.ada,comp.object Subject: Re: Merits of re-dispatching [LONG] Date: Sat, 16 Feb 2002 12:10 +0000 (GMT Standard Time) Message-ID: References: <3c6bcb27.4632484@News.CIS.DFN.DE> Reply-To: brangdon@cix.co.uk NNTP-Posting-Host: pc2-clif3-0-cust11.not.cable.ntl.com (80.4.39.11) X-Trace: fu-berlin.de 1013861317 1216853 80.4.39.11 (16 [57443]) Xref: archiver1.google.com comp.lang.ada:20077 comp.object:34516 Date: 2002-02-16T12:10:00+00:00 List-Id: dmitry@elros.cbb-automation.de (Dmitry A. Kazakov) wrote (abridged): > That there are three types changes nothing. It works pretty well in > Ada 95: That still doesn't capture the full complexity, because although you have Foo you don't have a Call_Foo. The call to Foo from within Call_Foo must be dispatching, because it must dispatch to different places. Given that it can do this, it's simplest to say the call to Foo from within the destructor is dispatching too, in the same way. So there is no non-dispatching call in the C++. I don't know Ada, but I think it would look like: type A is ... procedure Foo (Object : A) is begin Put_Line ("A.Foo"); end Foo; procedure Call_Foo (Object : A) is begin Foo( Object ); -- Dispatching, A.Foo or B.Foo called. end Foo; procedure Finalize (Object : in out A) is begin Call_Foo (Object); Foo (Object); end Finalize; type B is new A ... procedure Foo (Object : B) is begin Put_Line ("B.Foo"); end Foo; procedure Finalize (Object : in out B) is begin Call_Foo (Object); Foo( Object ); Finalize (A (Object)); end Finalize; This should produce B.Foo B.Foo A.Foo A.Foo. The call to Foo from B.Finalize can use exactly the same implementation as the call to Foo from A.Call_Foo. Both end up in B.Foo when the object is of type B. Both are dispatching calls. Dave Harris, Nottingham, UK | "Weave a circle round him thrice, brangdon@cix.co.uk | And close your eyes with holy dread, | For he on honey dew hath fed http://www.bhresearch.co.uk/ | And drunk the milk of Paradise."