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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c9a5d6b3975624e1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-04 10:35:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!news2.euro.net!uunet!ash.uu.net!spool0901.news.uu.net!spool0900.news.uu.net!reader0901.news.uu.net!not-for-mail Date: Fri, 04 Oct 2002 13:35:06 -0400 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.2b) Gecko/20021003 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: OO in Ada References: <3D9D02F3.9090600@worldnet.att.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1033752899.224298@master.nyc.kbcfp.com> Cache-Post-Path: master.nyc.kbcfp.com!unknown@mosquito.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1033752900 reader1.ash.ops.us.uu.net 29538 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:29515 Date: 2002-10-04T13:35:06-04:00 List-Id: Jim Rogers wrote: > In C++ this syntax is good for virtual functions > but illegal for static functions. This causes nasty > problems in C++ template construction. You don't mean 'virtual' and 'static', you mean 'member function' and 'non-member function'. It's not so much an issue of nasty problems. It's just that having two different notations for calling a method means that when you're writing a template you have to know which notation to use, which limits its genericity. > C++ (and Java) forbid dispatching based upon the > return type of a function. This is one of the > side effects of the 'object.method' notation. Your first statement is true, but your second is false. Why do you think object.method would prevent dispatching on return type? > should be phased out by allowing [member] functions > to be called in the same way as [non-member] functions. It will never be phased out, of course, since that would destroy millions of lines of code. Someone might come up with a reasonable proposal for allowing the method(object) notation, though. The problem is the impact this owuld have on overloading and name lookup, which is already extremely complicated. The design issue for C++ is that sometimes you want member functions as part of an interface and sometimes you want standalone functions. Having a different calling notation makes it harder to switch the function from one type to the other, because you have to modify all the callers. On the other hand, Ada gives the illusion of multiple dispatch by allowing several parameters to control dispatching, but then forcing them all, at runtime, to have the same dynamic type. I suppose some future version of Ada could lift this restriction while keeping the same notation, which is good.