comp.lang.ada
 help / color / mirror / Atom feed
From: osinski@hellgate.cs.nyu.edu (Ed Osinski)
Subject: Re: ADA Objects  Help!
Date: 23 Jan 1995 23:47:49 GMT
Date: 1995-01-23T23:47:49+00:00	[thread overview]
Message-ID: <3g1f75$fj1@thecourier.cims.nyu.edu> (raw)
In-Reply-To: 3flk3r$8qj@gdls.com

In article <3flk3r$8qj@gdls.com>, wilkinso@gdls.com (Robert M. Wilkinson) writes:
|> In article <D2H5un.FEr@nntpa.cb.att.com>,
|> Kenneth Almquist <ka@socrates.hr.att.com> 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
---------------------------------------------------------------------



  parent reply	other threads:[~1995-01-23 23:47 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3f9g1u$j4m@nps.navy.mil>
     [not found] ` <D2H5un.FEr@nntpa.cb.att.com>
     [not found]   ` <3fcs59$70s@nps.navy.mil>
     [not found]     ` <3ff186$c19@gnat.cs.nyu.edu>
1995-01-17 17:57       ` ADA Objects Help! Mats Weber
1995-01-18 17:47         ` Robert Dewar
1995-01-20 16:04           ` Mats Weber
1995-01-21 18:59             ` Robert Dewar
1995-01-23 12:03               ` Robb Nebbe
1995-01-25 20:44                 ` Mats Weber
1995-01-25 20:44               ` Mats Weber
1995-01-27  4:03                 ` Robert Dewar
1995-01-26  3:36           ` swdecato
     [not found]         ` <3fhggr$11dp@watnews1.watson.ibm.com>
     [not found]           ` <Mats.Weber-1901951739360001@mlma11.matrix.ch>
1995-01-20 17:22             ` Norman H. Cohen
1995-01-23 16:37               ` Mats Weber
1995-01-25 20:44               ` Mats Weber
1995-01-27  4:05                 ` Robert Dewar
1995-01-19 11:57   ` Robert M. Wilkinson
1995-01-22 18:06     ` Robert Dewar
1995-01-24 22:18       ` Norman H. Cohen
1995-01-25  1:26         ` swdecato
1995-01-25 18:18           ` Bob Kitzberger
1995-01-25 20:11             ` Bob Kitzberger
1995-01-26 15:31           ` Norman H. Cohen
     [not found]           ` <D330pK.M1@nntpa.cb.att.com>
1995-01-28 21:46             ` John DiCamillo
1995-01-30 14:13               ` David Emery
1995-01-30 22:50               ` Subject/Object Confusion Syndrome [was: Ada Objects Help] John Volan
1995-02-01 14:33                 ` Norman H. Cohen
     [not found]                   ` <D3DpJu.4nK@swlvx2.msd.ray.com>
     [not found]                     ` <D3H7J3.B2x@inmet.camb.inmet.com>
1995-02-06 10:32                       ` Robb Nebbe
     [not found]                     ` <3gu21g$ch@portal.gmu.edu>
1995-02-06 14:01                       ` John Volan
1995-02-01 22:37                 ` Maarten Landzaat
     [not found]                   ` <3h1ahp$gf5@gnat.cs.nyu.edu>
     [not found]                     ` <3h3jmp$1h1@Starbase.NeoSoft.COM>
1995-02-07 14:39                       ` John Volan
1995-02-09  2:25                         ` David Weller
1995-01-29 18:19             ` ADA Objects Help! mat
     [not found]               ` <1995Feb5.180601@hobbit>
1995-02-07 23:04                 ` Subject/Object Confusion Syndrome [was: Ada Objects Help] John Volan
1995-01-25  9:48       ` ADA Objects Help! mat
1995-01-23 10:01     ` calling syntax (was Re: Ada Objects) Robb Nebbe
1995-01-23 18:08       ` John DiCamillo
1995-01-23 23:47     ` Ed Osinski [this message]
1995-01-25  6:19       ` ADA Objects Help! David O'Brien
     [not found] ` <1995Jan16.132400@lglsun.epfl.ch>
     [not found]   ` <131279@cup.portal.com>
1995-01-20 16:52     ` Ada " Robert Dewar
1995-01-22 18:30       ` Tucker Taft
1995-01-24 22:09         ` Jacob Sparre Andersen
1995-01-26 16:20           ` Robert A Duff
1995-01-27 17:04             ` Robert A Duff
1995-01-27 19:58             ` Tucker Taft
1995-01-20 17:41   ` Mark S. Hathaway
1995-01-23 10:41     ` Robb Nebbe
1995-01-23 11:53     ` Stephane Barbey
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox