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,2078dddcdcd8d83 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Warning: Religious naming convention discussion :-) [was: assign help!!] Date: 1997/05/10 Message-ID: #1/1 X-Deja-AN: 240634411 References: <5kjvcv$evt@news.cis.nctu.edu.tw> <5kn8ko$jcc@top.mitre.org> <1997May7.201035.2439@nosc.mil> <33727EEA.2092@sprintmail.com> <5kuf1j$17vi@uni.library.ucla.edu> <3373666A.31DFF4F5@spam.innocon.com> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-05-10T00:00:00+00:00 List-Id: John Volan says <<"John G. Volan" writes: ... >I only wish the original designers of Ada83 had clued into this style >from the start. I find myself wishing Ada95 looked more like this: > Integer : Integer_Type; > Natural : Natural_Type; > Float : Float_Type; > Boolean : Boolean_Type; > Character : Character_Type; > String : String_Type; > Duration : Duration_Type;>> It really is remkarable how some people can take a good idea, and then kill it by applying it in a completely blind manner. Assuming (a bit of a reach) that the above is NOT meant as humour, I really find it hard to believe that anyone would prefer Integer_Type to Integer. For the last 40 years, millions of programmers have read billions or even trillions of lines of code in which we have a firm convention of using very simple words like int or Integer for simple predefined types. Why would anyone want to type extra junk in their program to override this universal convention? At the same time, I find it quite reasonable to add a suffix of _Type in cases which are less familiar and where it helps the reader. For my view of the dividing line look at the GNAT sources. So for example, universal integers, which are so pervasive, are called Uint, but on the other hand, we use Line_Number_Type. I do not see for a moment that changing Uint to Universal_Integer_Type throughout the GNAT sources would achieve anything except to make the sources a bit harder to read, and to increase the size of the tar file! In its blind use-it-all-the-time mode suggested above, I find the _Type suffix rule to be similar to the horrible encoding rules that some C coders use. P.S. The issue of how much to worry about classification of names like this quite depends on availabilty of tools. If you have a tool (like GNAT running under EMACS using GNATF to provide xref information) that allows you to instantantly locate the defining occurrence of a given identifier (useful Algol-68 term :-) then the balance shifts in favor of less encoding. The trouble is that in choosing a name, we are trying to satisfy two needs at the same time. o Give maximum help to someone looking at the sources for the first time who does not know their way around. o Don't generate too much unnecessary noise for someone who *does* know their way around the sources. Obviously familiarity plays a big role. Every Ada programmer knows the type name Integer, and therefore changing it to Integer_Type would badly damage the second objective without helping the first objective. On the other hand, a less familiar type name may suggest giving more weight to the first objective.