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-Thread: a07f3367d7,3ef3e78eacf6f938 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: A few Ada questions Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <3nffbo4zt7kp$.5i3qwunv8h7g.dlg@40tude.net> Date: Fri, 24 Jul 2009 17:01:20 +0200 Message-ID: <1e5b19rkwjr5v$.qyx0md92qthx.dlg@40tude.net> NNTP-Posting-Date: 24 Jul 2009 17:01:18 CEST NNTP-Posting-Host: 0ad0a301.newsspool3.arcor-online.net X-Trace: DXC=Vk;HXaE1lVXaoembcbF;DQMcF=Q^Z^V3X4Fo<]lROoRQ^YC2XCjHcbYcNX<1=;Ii>WDNcfSJ;bb[UIRnRBaCd5D^_E26=\HF`DZ X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:7323 Date: 2009-07-24T17:01:18+02:00 List-Id: On Fri, 24 Jul 2009 15:26:05 +0000, Colin Paul Gloster wrote: > On Fri, 24 Jul 2009, Dmitry A. Kazakov wrote: > >|---------------------------------------------------------------------------| >|"[..] | >| | >|That won't work because Ada does not have multiple dispatch (MI). When you | >|derive from the container and from the cursor then to have it polymorphic | >|you need operations dispatching in both container and cursor. This is MI, | >|which is absent, alas. | >| | >|[..]" | >|---------------------------------------------------------------------------| > > The particular example give involves multiple inheritance, but in > general I do not believe that multiple inheritance is needed for > multiple dispatch (multimethods). Yes, you are right it was a typo error, should be "MD". Interestingly, for the container - cursor case as in many other cases, one actually needs only a "half" of MD.. It is not the whole matrix of possible combinations container type x cursor type, but rather its diagonal, which has targets. Physically it is still single dispatch which only appears as multiple dispatch. I don't know if one could take any advantage or simplification from this. For multi-methods Ada already has this sort of dispatch. One can declare a primitive operation with two controlling arguments of same type: type Container is tagged ...; procedure Copy (From : Container; To : in out Container): -- This OK since Ada 95 If tagged Cursor could derive its tags from the corresponding container's tag, we could have "same" case. Considering: type Container is tagged ...; type Cursor is tagged ...; for Cursor'Tag use new Container'Tag; -- This is not Ada procedure Index (List : Container; Index : Cursor) return Element; Allowed because Container'Tag and Cursor'Tag are same / synchronous. Overriding Index would be possible only when both Container and Index are synchronously derived from the base. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de