comp.lang.ada
 help / color / mirror / Atom feed
From: jsa@alexandria (Jon S Anthony)
Subject: Re: Ada95 OOP Questions
Date: 1996/08/21
Date: 1996-08-21T00:00:00+00:00	[thread overview]
Message-ID: <JSA.96Aug21143151@alexandria> (raw)
In-Reply-To: 4tf3l4$4hu@masala.cc.uh.edu


In article <dazq3xu7ul.fsf@explorer2.clark.net> ecn@explorer2.clark.net (Eric C. Newton) writes:

> My problem is that I like having *BOTH* a person package *AND* a
> person class encapsulation mechanism.  I can live with just one or the
> other, but I like both.

What does this give you?  Certainly you can nest a person "class" package
inside of a personS package.


> The point of the (deleted) example was to show that a package is just
> a namespace, and that multiple classes can live in that namespace, and
> that the features of the class do not need to be visibly associated
> with the dispatch object.

Yes.  And I "shrug" to that.  Same sort of situation for Dylan or
CLOS.  Of course, that doesn't make it "good" by definition or
something.  Just that this is a specific design choice balancing
various requirements, reasons, etc.


> *I* know I can create little packages for each class.  *I* know that
> they are equivalent.  I think there is a case to be made that the Ada
> approach can be beneficial in some cases (such as in tightly coupled
> classes such as Matrix and Vector).  BUT, I think I would miss the
                                              ^^^^^
> textual grouping and extra encapsulation level

Maybe.  But I see the operative word here as "think".  What's really at
issue is "this is what I am used to".  Which is a definite point, but
can also close off potentially "better" alternatives.


> I was just pointing out that Objects need not be encapsulated with
> respect to each other and that dispatching is not obvious at the call
> site.

Actually, dispatching is _more_ obvious at the call site than in
something like Eiffel or C++.  That's because dispatching is a local
thing - _indicated_ at the specific invocation.  In C++ or Eiffel you
indicate this dispatching (virtual in C++) or non dispatching (frozen
in Eiffel [this is not quite the same, but prevents dispatch])
behavior back in the class definition.  Also, once it's made it is
pretty much fixed (you have to go back and hack the class to change
it).  In Ada you pick what you want at the particular call site and
indicate it.  In general this is pretty explicit:

   A : T;

   Op(T'Class(A));  -- Dispatch
   Op(A);           -- No dispatch

or

   A : T'Class; -- Typical of a class wide operation signature which
                -- will dispatch internally for specific behavior

   Op(A); -- dispatches...

In any event for any call, you only need to look around _locally_ to
see if the parameter to the Op is classwide - if so the Op dispatches.
In the other two example cases, you have to go back to the class
definition to be sure.


> abstraction.  I suppose that Object-Oriented programmers like myself
> are simply looking for the comfortable encapsulated, abstract,
> polymorphic entity they know and love in a single construct.  This
> discussion has helped me understand the Ada approach, and maybe it
> will help me explain it to others.

Sounds good to me!


/Jon
-- 
Jon Anthony
Organon Motives, Inc.
1 Williston Road, Suite 4
Belmont, MA 02178

617.484.3383
jsa@organon.com





  parent reply	other threads:[~1996-08-21  0:00 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-28  0:00 Ada95 OOP Questions Spasmo
1996-07-28  0:00 ` David C. Hoos, Sr.
1996-07-28  0:00   ` Spasmo
1996-07-28  0:00 ` Andre Spiegel
1996-07-28  0:00   ` Spasmo
1996-07-29  0:00     ` Thomas Kendelbacher
1996-07-31  0:00       ` Spasmo
1996-08-01  0:00         ` Thomas Kendelbacher
1996-08-02  0:00         ` Gene Ouye
1996-08-01  0:00       ` Jon S Anthony
1996-07-30  0:00     ` Ken Garlington
1996-08-04  0:00       ` Spasmo
1996-07-30  0:00     ` David Wheeler
1996-07-31  0:00       ` Spasmo
1996-07-29  0:00 ` Andre Spiegel
1996-07-29  0:00   ` Thomas Kendelbacher
1996-08-02  0:00     ` Robert Dewar
1996-08-05  0:00       ` Thomas Kendelbacher
1996-08-06  0:00         ` Robert Dewar
1996-08-06  0:00           ` Thomas Kendelbacher
1996-08-06  0:00             ` Robert A Duff
1996-08-07  0:00               ` Robert Dewar
1996-08-08  0:00                 ` Robert A Duff
1996-08-09  0:00                   ` Robert Dewar
1996-08-12  0:00             ` Robert I. Eachus
1996-08-08  0:00           ` Theodore E. Dennison
1996-08-09  0:00             ` Robert Dewar
1996-08-12  0:00             ` Joel VanLaven
1996-08-06  0:00         ` Robert I. Eachus
1996-08-10  0:00         ` Chris Morgan
1996-07-29  0:00   ` David Wheeler
1996-07-30  0:00     ` Spasmo
1996-07-30  0:00     ` Spasmo
1996-07-30  0:00 ` Andre Spiegel
1996-07-30  0:00 ` Andre Spiegel
1996-07-30  0:00 ` Robert I. Eachus
1996-08-01  0:00 ` Jon S Anthony
1996-08-13  0:00 ` Eric C. Newton
1996-08-14  0:00 ` Jon S Anthony
1996-08-14  0:00 ` Ken Garlington
1996-08-14  0:00 ` Eric C. Newton
1996-08-21  0:00 ` Jon S Anthony [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-08-08  0:00 W. Wesley Groleau (Wes)
1996-08-20  0:00 Farshad Nayeri
1996-08-21  0:00 ` Jon S Anthony
1996-08-20  0:00 Farshad Nayeri
replies disabled

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