comp.lang.ada
 help / color / mirror / Atom feed
From: stt@henning.camb.inmet.com (Tucker Taft)
Subject: Re: Ada Objects Help!
Date: Sun, 22 Jan 1995 18:30:21 GMT
Date: 1995-01-22T18:30:21+00:00	[thread overview]
Message-ID: <D2tKqM.54v@inmet.camb.inmet.com> (raw)
In-Reply-To: 3fopnh$9k1@gnat.cs.nyu.edu

In article <3fopnh$9k1@gnat.cs.nyu.edu>, Robert Dewar <dewar@cs.nyu.edu> wrote:

>"How can Ada be object oriented if you always have to pass the data to the
>function?"
>
>I have a clearer version of this question
>
>"How can Ada be object oriented if the second and third characters of its
> name are not special characters?"
>
>:-)

As Robert is implying, object-oriented languages differ in both significant
and insignificant ways.  Clearly you need to identify the object which
is the "target" when invoking an operation.  In C++ and Smalltalk, this object
is identified in a "prefix" of the invocation of the operation.  In
Ada 95 and CLOS (Common Lisp Object System), this object is identified
as one of the parameters of the invocation of the operation.

It turns out that the Ada 95/CLOS approach is somewhat more powerful,
in that you can syntactically transform the C++/Smalltalk "prefix"
notation into the Ada 95/CLOS "parameter" notation, but not necessarily
vice-versa.  Both Ada 95 and CLOS allow multiple "objects" controlling
the dispatch, making binary operations simpler and more symmetrical.
Ada 95 is unique in allowing the result context to control the run-time 
dispatch.  CLOS is more general in that a best-fit pattern match is performed
at run-time to decide which implementation to invoke (roughly analogous
to the best-fit compile-time overload resolution algorithm that 
C++ performs), while Ada 95 requires a "perfect" match (allowing a simple
single-level-of-indirection to perform the dispatch).

So when you see "object->operation(other params)" in C++ or
"object op other-params" in Smalltalk, you can imagine
this as "operation(object, other params)" in Ada 95 (or 
"(operation object other-params)" in CLOS).  When implementing
an operation in Ada 95, the implicit "this" parameter in C++
becomes a normal "formal" parameter in Ada, with a name picked by
the programmer (the programmer could chose "This" if desired).

Although there are some semantic implications of this choice of prefix
vs. parameter notations, by and large it is a syntactic choice.

-Tucker Taft   stt@inmet.com
Intermetrics, Inc.



  reply	other threads:[~1995-01-22 18:30 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     ` ADA Objects Help! Ed Osinski
1995-01-25  6:19       ` 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 [this message]
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