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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1ff5003422436e4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-10-05 20:44:25 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!MathWorks.Com!news.duke.edu!concert!bigblue.oit.unc.edu!not-for-mail From: "Eric S. Sessoms" Newsgroups: comp.lang.ada Subject: Re: Easily-Read C++? Date: Wed, 5 Oct 1994 10:26:24 -0400 (EDT) Organization: The University of North Carolina at Chapel Hill Message-ID: NNTP-Posting-Host: ruby.ils.unc.edu Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In-Reply-To: <941005030023_73672.2025_DHR103-1@CompuServe.COM> Date: 1994-10-05T10:26:24-04:00 List-Id: On Tue, 4 Oct 1994, Ken Garlington wrote: > Robin Rowe writes: > > << Here's how I read a piece of C++ code: > > if(!object) // "If not object [then]" > { cerr< } // message," > else // "else" > { object++; // "increment object." > } > > So what's unnatural about this? Sounds like English to me. >> I've been giving a lot of thought to this readability issue, since as a native C/C++ speaker, I find the readability of Ada to be one of its strong points. BUT, the factors I find contribute most to the readability of Ada do not include its "englishness". Rather, some of the language features such as subrange types, arbitrarily bounded arrays, and arrays over enumerated or character types seem (to me) to make the greatest contribution. (And nested procedure declarations, can't forget that!) Now, as Robin Rowe pointed out, these are not foreign concepts in C++. In fact, they are all rather trivial given the wonderful C++ template mechanism, but that's where they fall. *The necessary templates are not standard.* By taking these low level concepts as part of the language, Ada has standardized a much larger part of what (some) programmers (like me) do. The net effect is that in moving from one person's code to another (or one shop's code to another, if they impose shop standards) there is a slight decrease in reading effort from not having to re-learn how Coder X has chosen to implement a few necessary low-level concepts. just to throw in some pseudo-code: enum days_of_week { sunday, monday, tuesday, wednesday, ..., saturday }; typedef Bounded week_days; Array beers_drank; beers_drank[wednesday] = 0; Having only one integer type is also nice. Why, nearly as nice as "class Integer {...};"! Do you see my point? I really doubt there is much in Ada that you can't have in C++, but in Ada it is (1) easier and (2) standardized -- so convince me that standardization gives you something more than a larger language standard. IMHO, it helps _a_lot_. IMHO, it will all be moot once standardized C++ class libraries become commonly available. Responses? Ideas? Criticisms? I'm very tired of "'begin end' is better than '{ }'" arguments, and the "Ada programmers use longer names" arguments, but I would be very interested in any further discussion of what language elements contribute either to the readability of Ada or of C++. Please post follow-ups here and direct all flames to: eric sessoms (sesse@ruby.ils.unc.edu)