comp.lang.ada
 help / color / mirror / Atom feed
From: "W. Wesley Groleau (Wes)" <wwgrol@PSESERV3.FW.HAC.COM>
Subject: Re: Ada95 OOP Questions
Date: 1996/08/08
Date: 1996-08-08T00:00:00+00:00	[thread overview]
Message-ID: <9608082242.AA14378@most> (raw)


You also have a readability question with regard to the syntax you've
been discussing.  If  Fred is type (class) Person  and  Fido is Dog, then at
first glance what would be the "intuitive" output of the following?

   C++   -   Fred.bite(Fido)           Ada   -   Persons.Bite(Fred,Fido);

Is it  "Yelp!"  or  "You miserable mutt!"   ?    :-)
Not a very good example, but what I'm getting at is, if you're using
English words for your identifiers, then English word order can reinforce
or work against the meaning in either case.  In previous posts,

   C++      Fred.eat;                 Ada        Persons.Eat(Fred);

If these are equivalent, perhaps the Ada translation should be
                                      Persons.Eating_Should_Be(Fred);
:-)

Now set that foolishness aside.  Do you want to make your Ada look like
C++ ?  Without giving up arrays and linked lists?  Although they weren't
intended for this, protected types/objects can do it!  They can have
not only functions, but procedures and entries.

protected type Person is  -- maybe 'does' should be a synonym for 'is' :-)
  procedure Eat;
  procedure Sleep;
  procedure Work;
  -- is there more to life?
end Person;

type Crowd is array (Natural range <>) of Person;

-- I am sure the rest is obvious....

... and even Ada-83 could do it with task types, provided identifiers
    were carefully chosen.  Not that I would necessarily recommend it,
    but it may in some designs model the real world better than
    non-concurrent objects.



---------------------------------------------------------------------------
W. Wesley Groleau (Wes)                                Office: 219-429-4923
Hughes Defense Communications (MS 10-40)                 Home: 219-471-7206
Fort Wayne,  IN   46808                  (Unix): wwgrol@pseserv3.fw.hac.com
---------------------------------------------------------------------------




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

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-08  0:00 W. Wesley Groleau (Wes) [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-08-20  0:00 Ada95 OOP Questions Farshad Nayeri
1996-08-21  0:00 ` Jon S Anthony
1996-08-20  0:00 Farshad Nayeri
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     ` David Wheeler
1996-07-31  0:00       ` Spasmo
1996-07-30  0:00     ` Ken Garlington
1996-08-04  0:00       ` Spasmo
1996-07-28  0:00 ` David C. Hoos, Sr.
1996-07-28  0:00   ` Spasmo
1996-07-29  0:00 ` Andre Spiegel
1996-07-29  0:00   ` David Wheeler
1996-07-30  0:00     ` Spasmo
1996-07-30  0:00     ` Spasmo
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 I. Eachus
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-10  0:00         ` Chris Morgan
1996-07-30  0:00 ` Andre Spiegel
1996-07-30  0:00 ` Robert I. Eachus
1996-07-30  0:00 ` Andre Spiegel
1996-08-01  0:00 ` Jon S Anthony
1996-08-13  0:00 ` Eric C. Newton
1996-08-14  0:00 ` Eric C. Newton
1996-08-14  0:00 ` Jon S Anthony
1996-08-14  0:00 ` Ken Garlington
1996-08-21  0:00 ` Jon S Anthony
replies disabled

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