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,982ed90dd25179ec X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-06 15:13:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn13feed!wn14feed!worldnet.att.net!bgtnsc04-news.ops.worldnet.att.net.POSTED!not-for-mail From: "David Thompson" Newsgroups: comp.lang.ada References: <1041186672.615164@ns2-ext.dcu.ie> <8EIP9.19113$p_6.1493222@bgtnsc04-news.ops.worldnet.att.net> Subject: Re: point by point advantages of Ada X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Message-ID: <24oS9.30853$p_6.2594702@bgtnsc04-news.ops.worldnet.att.net> Date: Mon, 06 Jan 2003 23:13:02 GMT NNTP-Posting-Host: 12.94.164.40 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1041894782 12.94.164.40 (Mon, 06 Jan 2003 23:13:02 GMT) NNTP-Posting-Date: Mon, 06 Jan 2003 23:13:02 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:32649 Date: 2003-01-06T23:13:02+00:00 List-Id: James S. Rogers wrote : ... > The solution for such a need is basically the same in both C++ and Ada. > C++ provides no multiple dispatch capability. You must make such a > function static, not virtual. In Ada you do the same thing. You simply > define the procedure(s) taking more than one tagged type in another > scope. An inner package is a common choice for another scope. > static is not the opposite of virtual, see below. In C++ you can allow the normal, implicit dispatch on one type (virtual) and do the other(s) explicitly; or have a nonvirtual function that does both/all. Yes in Ada the options are effectively the same. ... > What the original author does not mention is that C++ cannot dispatch > based upon the return type of a function. This is done cleanly in Ada and > not at all in C++ (or Java). > Ada uses return type to resolve overloading (at compile time), but not to dispatch (possibly at run time). (C++ and Java do neither.) > In C++ you need to explicitly label a function as "virtual". The default is > "static". In Java the default is the equivalent of virtual, and you must > explicitly label "static" functions with the "static" keyword. In Ada > functions are primitive to a type if they are declared in the same scope > as the declaration of the type. That is, the "primitive" property is defined > by scope, and not by the presence or absence of a reserved word. > This is different from C++ and Java, but those languages also differ > from each other. Such differences do not prove superiority. > C++ virtual and Java *final* are opposites, and yes the default is reversed, but *static* (in both) is quite different -- it specifies methods or variables which are per-class not per-instance. (As well as having other meanings in C++, and C, for things not in a class.) -- - David.Thompson 1 now at worldnet.att.net