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-Thread: 103376,131f06967722ab4b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ada 2005? Date: Tue, 21 Dec 2004 18:12:55 +0100 Organization: cbb software GmbH Message-ID: <1vj2pp9437gal.1b1lyqe3o973k$.dlg@40tude.net> References: <1103344064.372396.51420@c13g2000cwb.googlegroups.com> <1n1v6175zrtcc.2g6ewdvu7ei5$.dlg@40tude.net> <1103568585.285484.237450@c13g2000cwb.googlegroups.com> <20xbhf8rjd33.t7dojmf0ky12.dlg@40tude.net> <1nl7gq6tozeyw.146x7at50m0lr.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: individual.net mL69PQNFNTpAYVAG84wBSwnmM2MQf6tTc8NcDNIUesM/J6ym0= User-Agent: 40tude_Dialog/2.0.12.1 Xref: g2news1.google.com comp.lang.ada:7129 Date: 2004-12-21T18:12:55+01:00 List-Id: On 21 Dec 2004 12:10:21 -0500, jayessay wrote: > "Dmitry A. Kazakov" writes: > >> On 20 Dec 2004 18:44:14 -0500, jayessay wrote: >> >>> "Dmitry A. Kazakov" writes: >>> >>>> Copy is a friend, but they are not methods. C++ does not support multiple >>>> dispatch. >>> >>> Yes, but to be clear, neither does Ada. >> >> Surprisingly, but it does: >> >> procedure Foo (X, Y : Some_Tagged_Type); -- This is legal >> >> Though it is very limited and cannot be counted as true multiple dispatch. > > Right. All the parameters in a dispatching call to such a case must > resolve to the _same_ type (IIRC) and so it isn't "multiple" dispatch > at all. True multiple dispatch occurs when such profiles can be > called where the parameters resolve to different types (often not even > in the same branch of the type hierarchy) and the correct method is > dynamically invoked (1,2). > > 1. For an example of of multiple dispatch, see generic functions, > method resolution and dispatch in CLOS: > > http://www.lispworks.com/reference/HyperSpec/Body/07_f.htm > http://www.lispworks.com/reference/HyperSpec/Body/07_ff.htm The problem with MD is not target method resolution, which is quite trivial, but safety in presence of inheritance with combinatorial explosion of target methods to override. I doubt that CLOS seriously approaches the problem. Consider Ada. To provide MD on independent type hierarchies, you should relax freezing rules for primitive operations. Doing so you have a great problem of keeping the dispatching table consistent. > 2. Overloading gives a kind of static version of this. ... being absolutely unsafe. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de