Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbjade.BERKELEY.EDU Path: utzoo!watmath!clyde!burl!ulysses!ucbvax!ucbjade!mwm From: mwm@ucbopal.BERKELEY.EDU (Mike (I'll be mellow when I'm dead) Meyer) Newsgroups: net.lang.c Subject: Re: "C" wish list/semicolons Message-ID: <142@ucbjade.BERKELEY.EDU> Date: Tue, 5-Nov-85 23:13:06 EST Article-I.D.: ucbjade.142 Posted: Tue Nov 5 23:13:06 1985 Date-Received: Thu, 7-Nov-85 05:38:17 EST References: <335@graffiti.UUCP> <895@rlvd.UUCP> <742@mmintl.UUCP> <6107@utzoo.UUCP> Sender: network@ucbjade.BERKELEY.EDU Reply-To: mwm@ucbopal.UUCP (Mike (I'll be mellow when I'm dead) Meyer) Organization: Missionaria Phonibalonica Lines: 44 Keywords: language design C semicolons argh Humbug! People arguing about whether semicolons should separate or terminate statements are in the same class as people arguing whether 8080's or 6502's are the microprocessor of choice. There's a commonly used better way than either alternative. The thing to remember is that PEOPLE are the most important readers of a program. If they can't read and understand it, they can't maintain it. Taking that into account, the best thing for semicolons is: Let them separate two staments on the same line. Let line breaks terminate statements if it makes sense to do so. For example, a block could look like: { x = 23; y = 40 z = x + y printf("Messy Format", x, y, z, f) /* Statement didn't end, as it wouldn't parse */ f = x + 7 /* Does this end? */ * y /* Uh, no... */ } No mess, no sweat when adding statements. Fewer kestrokes, and it's easier to read than either other version. Since modern languages like CLU, Icon and BCPL (BCPL! Waitaminute!) allow this, I think it belongs on any C wish list. Note that it wouldn't break existing programs, either (well, I *hope* it wouldn't, but C expression are such a mess that it might. Moving one token one line should fix things in all cases). Note: I haven't considered all the problems implicit in doing this in C. I'd rather work on modern languages. But this started as a "wish list." Second Note: The example was chosen to illustrate the features, not for readability. If you think putting semicolens at the end of each statement will improve the readability of the example, you have my sympathy.