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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,56131a5c3acc678e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-10 03:28:15 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!tar-atanamir.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Question about OO programming in Ada Date: Wed, 10 Dec 2003 12:32:39 +0100 Message-ID: <7nudtvkbrm1i0a05d0n3v05j8q9nrbs7u8@4ax.com> References: <1070889942.156714@master.nyc.kbcfp.com> <5lcBb.4138$UM4.2773@nwrdny01.gnilink.net> <1070976556.767919@master.nyc.kbcfp.com> <1070982307.973327@master.nyc.kbcfp.com> <7krbtv4bs50bm5gmdquteo3r0705ps58jt@4ax.com> <1070988116.464651@master.nyc.kbcfp.com> NNTP-Posting-Host: tar-atanamir.cbb-automation.de (212.79.194.116) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1071055693 15895 212.79.194.116 ([77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:3302 Date: 2003-12-10T12:32:39+01:00 List-Id: On Tue, 09 Dec 2003 11:41:56 -0500, Hyman Rosen wrote: >Dmitry A. Kazakov wrote: >> So what? > >So it's somewhat iconoclastic to regard the function as >the focus of the dispatching. You're doing it because you >are still pushing for your external fat-pointer dispatch >mechanism, which is why you decry the ability to redispatch. No, the reason is that redispatch violates strong typing. If the contract of a subprogram is that some parameter has a specific type, then why on earth a call to other subroutine with this parameter should dispatch? This is C++ design fault which uses same notation for both class-wide and specific types. Further, if that specific object is being converted to a class-wide, then why the result is not rooted in the type specified by the *contract*? This is Ada 95 design fault. Both faults stems from redispatch, which cannot be implemented in a type-safe and type-consistent way. >I rememeber the old discussion, but people who don't aren't >going to understand what you're fussing about, since the >dispatch table implementation mechanism is fixed in many >minds as the very definition of OO. I don't argue against dispatch tables. My point that a dispatch table belongs to a subroutine, not to an object. Then OO, as an approach, has little to do with implementation issues. It only states that there are dispatching subroutines. Note, subroutines, not "dispatching objects". >> If the type tag gets changed, then the type does as well. > >Yes, absolutely. > >> For an object of *same* type a dispatch to *same* method > > should yeld same target. > >Yes, absolutely. > >> It is not the case for C++. > >No, that's wrong. It *is* the case for C++. It is exactly not the case: class X { public : virtual void Foo () { printf ("X::Foo"); } virtual void Baz () { Foo (); } virtual ~X () { Baz (); } }; class Y : public X { public : virtual void Foo () { printf ("Y::Foo"); } }; void main () { Y A; A.Baz (); // dispatches to Y::Foo } // Y::~Y does not dispatch to Y::Foo This should print: Y::Foo X::Foo >> The target in constructor / destructor or their callee is same > > as if the method were not dispatching. > >No, that's wrong as well. Did you look at my sample code? >Calls to virtual functions are always dispatching. The type >used to dispatch upon may vary during the course of construction. > >> So I claim again, if it "dispatches" as a type-specific >> call, then it is type specific. > >I don't understand what this sentence means. See my example. -- Regards, Dmitry Kazakov http://www.dmitry-kazakov.de