comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: Printing Enum Variable Re: Linux World
Date: 1999/03/08
Date: 1999-03-08T00:00:00+00:00	[thread overview]
Message-ID: <m3lnh729s6.fsf@mheaney.ni.net> (raw)
In-Reply-To: 7bvufh$eel$1@remarQ.com

"Michael Young" <nobody@all.org> writes:

> > The advantage of the Ada syntax is that binary operations are
> > symmetrical.  You don't want to have a distinguished receiver, because
> > there isn't one -- there are two.  Indeed, there may be more.
> 
> Please explain the part about symmetry and two or more receivers. Do you
> mean something like:
> "Joe, meet Jane. Jane, meet Joe."
>   versus
> "Meet(Joe, Jane)"

That more or less captures it. 

The most obvious example is a test for equality:

  procedure Op (O1, O2 : T'Class) is
  begin
     if O1 = O2 then ...;


Equality is a binary operation, and dispatches on the tag of O1 and O2.
This is a lot nicer on the eyes than

  if O1.Equal (O2) then ...;


> I might be missing a whole bunch, but none of this seems really
> earth-shattering in terms of expressing a design.

Ada95 is a revision of Ada83.  There was an existing syntax and mind-set
for Ada83 that the designers of Ada95 wanted to preserve.

The C++ approach of adding an object-oriented "corner" to the language,
with a different syntax from other parts of the language, is exactly the
way they _didn't_ want to go.

 
> > The other benefit of the Ada way is that the syntax for manipulation
> of
> > user-defined types is consistent.  You don't want to have Yet Another
> > Notation just because the type happens to be tagged.
> >
> >   Push (Item, On => Stack);
> >
> > Is stack a tagged type or not?  I don't know -- but that's the point.
> 
> Yes, I see your point regarding notations, but what exactly does that
> mean? 

It was intended as an example of what I alluded to above.  There was an
existing syntax for manipulation of user-defined types, and the
designers wanted to preserve this.

> Could you be alluding to: aNumber.PushOnto(aStack)?

No.  Push is a primitive operation of Stack_Type.  It is not a binary
operation.


> One has to ask why Number needs to be aware of Stack at all. 

No, it doesn't.  I think I have only confused you.  (Sorry.)


> In terms of reader-friendliness, symmetry in notation seems more a
> liability than an asset when symmetry does not truly exist. In fact,
> few useful examples come to mind for symmetry in object designs. A
> uses B, but B is oblivious to A.

Push is not a symmetrical operation, and wasn't intended as an example
of one.  "Symmetrical operations" just means that

  A op B 

and 

  B op A 

have the same meaning.  Just like

  Meet (Joe, Jane);

means the same as

  Meet (Jane, Joe);

or

  Marry (Joe, Jane);

means the same as

  Marry (Jane, Joe);

Meet and Marry are operations that apply to two objects, and both
objects have equal importance as far as the operation is concerned.

Saying

  Joe.Marry (Jane);

is misleading.














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

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-02  0:00 Linux World Richard D Riehle
1999-03-02  0:00 ` fraser
1999-03-02  0:00   ` Printing Enum Variable " David Starner
1999-03-03  0:00     ` fraser
1999-03-03  0:00       ` David Starner
1999-03-03  0:00         ` fraser
1999-03-03  0:00         ` Samuel T. Harris
1999-03-04  0:00         ` robert_dewar
1999-03-03  0:00           ` David Starner
1999-03-04  0:00             ` robert_dewar
1999-03-04  0:00             ` Samuel Mize
1999-03-04  0:00               ` Samuel Mize
1999-03-05  0:00                 ` Robert A Duff
1999-03-05  0:00               ` Robert A Duff
1999-03-07  0:00               ` Florian Weimer
1999-03-07  0:00                 ` Michael Young
1999-03-07  0:00                   ` Larry Kilgallen
1999-03-07  0:00                     ` Michael Young
1999-03-08  0:00                       ` robert_dewar
1999-03-08  0:00                         ` Richard D Riehle
1999-03-09  0:00                           ` Michael Young
1999-03-09  0:00                             ` Larry Kilgallen
1999-03-09  0:00                               ` billy
1999-03-10  0:00                                 ` Pascal Obry
1999-03-10  0:00                                 ` robert_dewar
1999-03-10  0:00                                   ` Dale Stanbrough
1999-03-10  0:00                                     ` Pascal Obry
1999-03-10  0:00                                     ` Richard D Riehle
1999-03-10  0:00                                     ` dennison
1999-03-10  0:00                                       ` bob
1999-03-10  0:00                                         ` Mike Silva
1999-03-10  0:00                                           ` Nick Roberts
1999-03-10  0:00                                           ` dennison
1999-03-09  0:00                               ` Michael Young
1999-03-10  0:00                                 ` Mike Silva
     [not found]                               ` <7c4ru6$e45$1@remarq.com>
1999-03-10  0:00                                 ` fraser
     [not found]                               ` <7 <7c58qa$b6b$1@cf01.edf.fr>
1999-03-10  0:00                                 ` fraser
     [not found]                             ` <1999Mar9.131659. <dale-1003991644340001@r1021c-07.ppp.cs.rmit.edu.au>
1999-03-10  0:00                               ` Larry Kilgallen
1999-03-08  0:00                       ` Larry Kilgallen
1999-03-08  0:00                         ` robert_dewar
1999-03-08  0:00                       ` Florian Weimer
1999-03-07  0:00                   ` Matthew Heaney
1999-03-08  0:00                     ` Michael Young
1999-03-08  0:00                       ` Matthew Heaney [this message]
1999-03-04  0:00           ` Ehud Lamm
1999-03-05  0:00             ` Richard D Riehle
1999-03-05  0:00               ` Nick Roberts
1999-03-06  0:00                 ` Ehud Lamm
1999-03-06  0:00                   ` robert_dewar
1999-03-06  0:00                     ` Ehud Lamm
1999-03-06  0:00                     ` Larry Kilgallen
1999-03-06  0:00                       ` Dave Taylor
1999-03-06  0:00                         ` Bruce or Tracy
1999-03-04  0:00         ` dennison
1999-03-04  0:00           ` Ehud Lamm
1999-03-03  0:00     ` Larry Kilgallen
1999-03-03  0:00       ` Nick Roberts
1999-03-03  0:00         ` David Starner
1999-03-03  0:00     ` Fraser Wilson
1999-03-03  0:00       ` David Starner
1999-03-04  0:00         ` Magnus Larsson
1999-03-03  0:00           ` Hans Marqvardsen
1999-03-04  0:00             ` Nick Roberts
1999-03-04  0:00             ` robert_dewar
1999-03-04  0:00               ` Hans Marqvardsen
1999-03-05  0:00                 ` dewar
1999-03-05  0:00                   ` David Botton
1999-03-05  0:00                     ` robert_dewar
1999-03-05  0:00                 ` Larry Kilgallen
1999-03-04  0:00               ` Hans Marqvardsen
1999-03-05  0:00                 ` dewar
1999-03-07  0:00                   ` Hans Marqvardsen
1999-03-03  0:00           ` Printing Enum Variable Re: Linux World (Correction) Hans Marqvardsen
1999-03-04  0:00         ` Printing Enum Variable Re: Linux World Richard D Riehle
1999-03-04  0:00         ` fraser
1999-03-05  0:00           ` Nick Roberts
1999-03-05  0:00             ` fraser
1999-03-04  0:00         ` Richard D Riehle
1999-03-04  0:00         ` robert_dewar
replies disabled

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