From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b0d68c502c0ae6 X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Printing Enum Variable Re: Linux World Date: 1999/03/08 Message-ID: #1/1 X-Deja-AN: 452618696 Sender: matt@mheaney.ni.net References: <7bfc2n$jl9@dfw-ixnews5.ix.netcom.com> <7bhh26$r7c$1@remarQ.com> <36DCAC1F.430E2C5E@aasaa.ofe.org> <7bk4v8$kl8$1@remarQ.com> <36DDA761.7B4E8099@aasaa.ofe.org> <7bkrmm$ao1$1@nnrp1.dejanews.com> <36DE0007.5236CEA2@aasaa.ofe.org> <7bmmu2$n0h@news1.newsguy.com> <7btj81$j0d$1@remarQ.com> <7bvufh$eel$1@remarQ.com> NNTP-Posting-Date: Mon, 08 Mar 1999 09:00:27 PDT Newsgroups: comp.lang.ada Date: 1999-03-08T00:00:00+00:00 List-Id: "Michael Young" 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.