Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site eagle.UUCP Path: utzoo!watmath!clyde!burl!ulysses!eagle!mjs From: mjs@eagle.UUCP (M.J.Shannon) Newsgroups: net.lang.c Subject: re: more about programming style Message-ID: <1278@eagle.UUCP> Date: Thu, 11-Jul-85 23:01:56 EDT Article-I.D.: eagle.1278 Posted: Thu Jul 11 23:01:56 1985 Date-Received: Sat, 13-Jul-85 09:15:06 EDT References: <11485@brl-tgr.ARPA> Organization: AT&T Bell Laboratories, Summit, NJ Lines: 39 > In most cases, I think new programmers > have some obligation to use those idioms. Why? Because (contrary to your > example) in most cases someone reading your code is more likely than > not to be well versed in the language, and will be more confused by code which > doesn't use the established idioms. Witness the letters already submitted > in which people say strongly they find i++ more intuitive than i = i + 1. > > Craig Partridge Sorry, but I don't buy this. As a long term user of various UNIX Systems, I have used many of the `language' tools once, or perhaps as many as a dozen times. Mostly I use the C compiler, occasionally assisted by yacc and lex, but every once in a while a tool such as awk is more appropriate. Now, I am aware that some folks whose code I have access to, and have done extensive work in awk, have rather large sets of idioms (idia?), but how much time should I spend examining their code to ascertain the semantics of their idioms? What I have always done in the past (and, I dare say, shall continue to do) is write the application in such a way that someone fluent in the language in question can easily comprehend both the algorithm and the implementation of it. I will be the first to agree that "++i" is more readable (to experienced C programmers) than "i = i + 1", but if I were mostly a fortrash programmer writing some C interface programs to f77 (for example), I'd probably use the latter expression, because it more closely resembles the syntax and semantics of the language with which I am most familiar (hypothetically). One way of stating my opinion on this (admittedly religious) matter is: Sometimes it pays to be eloquent. It always pays to be clear, precise, and accurate. When I can achieve eloquence at little cost while maintaining clarity, precision, and accuracy, I will do so -- but only then. Can anyone claim that this is an unreasonable stance? If so, please do so via private mail; there is no need to further clutter this discussion with religious debates. -- Marty Shannon UUCP: ihnp4!eagle!mjs Phone: +1 201 522 6063