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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,c890e6ab3fb2c5fc X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,c890e6ab3fb2c5fc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-23 15:47:49 PST Path: nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!gw1.att.com!fnnews.fnal.gov!uwm.edu!news.alpha.net!news.mathworks.com!panix!cmcl2!thecourier.cims.nyu.edu!hellgate.cs.nyu.edu!osinski From: osinski@hellgate.cs.nyu.edu (Ed Osinski) Newsgroups: comp.lang.ada,comp.lang.c++ Subject: Re: ADA Objects Help! Date: 23 Jan 1995 23:47:49 GMT Organization: New York University Distribution: world Message-ID: <3g1f75$fj1@thecourier.cims.nyu.edu> References: <3f9g1u$j4m@nps.navy.mil> <3flk3r$8qj@gdls.com> Reply-To: osinski@cs.nyu.edu NNTP-Posting-Host: hellgate.cs.nyu.edu Xref: nntp.gmd.de comp.lang.ada:18219 comp.lang.c++:87738 Date: 1995-01-23T23:47:49+00:00 List-Id: In article <3flk3r$8qj@gdls.com>, wilkinso@gdls.com (Robert M. Wilkinson) writes: |> In article , |> Kenneth Almquist wrote: |> > |> >C++ has two procedure calling syntaxes. It is possible to write either |> > display(myptr); |> >or |> > myptr->display(); |> |> Please note that these have *entirely* different semantics; they are not |> merely "two forms of syntax" for the same thing. |> |> >These both call a procedure, passing the value myptr as the argument. |> >In contrast, Ada provides only a single procedure call syntax. |> > |> >When you declare a procedure in C++ you specify which syntax will be |> >used to call the procedure. |> |> Again, there is much more to it than just the syntax. One is a member |> function, the other is a plain-old function. Big, big, difference. Sure, but why does the caller need to know which one is used? |> >As a result, having the two syntaxes |> >provides the following functionality: |> > |> >1. Both Ada and C++ provide overloading, but in C++ it is possible for |> > two overloaded routines to have the same argument types as long as |> > the calling syntax is different. The two calls to "display" which |> > appear above call different routines. |> |> Of course they do. One calls a member function, the other does not. Think |> of it as calling two functions with the same signature, but residing in |> different packages. ... |> >My own opinion, formed before I knew anything about Ada 9X, is that this |> >functionality is not useful, and thus having two syntaxes increases the |> >complexity of the language without providing any corresponding benefit. |> |> Perhaps you need a better C++ book. If you cannot see the need for |> member functions, which is the heart and soul of C++, then you definitely |> do not understand the language. But that is *not* what Kenneth said. He simply doesn't see the need for two different syntaxes. Let me give you an example. In C++, the *same* syntax is used to call a virtual member function and a non-virtual member function. Is a virtual member function different from a non-virtual one in semantics? Of course they are, but that does not mean that there must be a different syntax for calling them. In fact, even C++ does let you use the non-member syntax for *some* members. They're called operators. When you see a + b and a and b are values of some user-defined type, the '+' could be a member function, or a non-member function, but the syntax to invoke either is identical. Ada95 has one consistent syntax for calling both member functions (or their nearest equivalent) and non-member functions. This doesn't seem to cause any problems. |> -- |> ____________________________________________________________________________ |> |> Rob Wilkinson wilkinso@gdls.com |> ____________________________________________________________________________ -- --------------------------------------------------------------------- Ed Osinski | Computer Science Department | "Do I know you? New York University | And don't try to deny it!" E-mail: osinski@cs.nyu.edu | Col. Flagg to Hawkeye ---------------------------------------------------------------------