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,5c72b6fec2f83257 X-Google-Attributes: gid103376,public From: Ken Garlington Subject: Re: Help: Binary operator "=" Date: 1997/06/08 Message-ID: <339B6B90.41F@lmco.com>#1/1 X-Deja-AN: 247139945 References: <3381c4ba.quantum@quantum.pc.my> <33932325.6E38@lmtas.lmco.com> Organization: Lockheed Martin Tactical Aircraft Systems Newsgroups: comp.lang.ada Date: 1997-06-08T00:00:00+00:00 List-Id: Robert Dewar wrote: > > Ken says > > < course... > > Some_Stack_Type.Push(Value => A_Thing.Object, Onto => A_Stack.Object); > -- nice > > if Some_Stack_Type.Is_Empty(A_Stack.Object) ... -- OK > > if Some_Stack_Type."="(A_Stack.Object, Another_Stack.Object) then ... > -- not nearly as nice as > if A_Stack.Object = Another_Stack.Object then ... > > Surely the increased readability is intuitively obvious! :) > >> > > Oh most certainly it is to me, getting rid of the silly Some_Stack_Type > prefix on "=" and deciding that you can use other means to figure out > where "=" comes from makes excellent sense to me. > > The only trouble is, I would apply the same reasoning to the annoying > Some_Stack_Type. prefix on the Is_Empty call. Indeed I don't see the > difference between the two cases. Either it is a problem to have to > find out where things are, necessitating the verbose prefixs, or it is > not, and the situation seems the same in both cases to me :-) :-) Which is why I characterized it as "OK" vs. "nice" in my comments. The (admittedly thin) distinction you could draw is as follows: Infix operators should be extremely obvious as to their definition (at least if written correctly). This is why it's probably OK to use some terse notation like "+" rather than Add. Non-infix operators are slightly less obvious, so having some additional information (like the type of stack on which they operate) might be useful. It's not so much being able to trace the location of their definition as providing useful information about the operation. I would say that, in the second case, either leaving on the name or taking it off would probably be all right. The second case actually reads better if the stacks are created from a generic abstract data object, instead of from an abstract data type, but then other problems (like how to define "=") become a problem... > > (the smileys are because this is an old discussion, hardlly worth repeating > unless someone has something new to say :-) It's not particularly new, but I find the whole idea of Ada style interesting. For a language that promotes readability, I think style should be a central issue. If Ada were used more, I would eventually expect a certain standard style to appear over time (a la "Elements of Style" for English). -- LMTAS - The Fighter Enterprise - "Our Brand Means Quality" Who uses Ada? See http://www.lmasc.lmco.com/f22 For job listings, other info: http://www.lmtas.com or http://www.lmco.com