Re: The semicolon habit (was: Q: Definition of a scripting lang.)

Charles Fiterman <cef@geodesic.com>
Wed, 19 Apr 1995 13:22:11 GMT

          From comp.compilers

Related articles
Re: Q: Definition of a scripting lang. lwall@netlabs.com (1995-03-27)
The semicolon habit (was: Q: Definition of a scripting lang.) prechelt@i41s25.ira.uka.de (1995-04-11)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) stidev@gate.net (1995-04-19)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) cef@geodesic.com (Charles Fiterman) (1995-04-19)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) ludemann@netcom.com (1995-04-28)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) scooter@mccabe.mccabe.com (1995-04-27)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) cg@Myrias.AB.CA (1995-04-27)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) schrod@iti.informatik.th-darmstadt.de (1995-04-28)
Re: The semicolon habit (was: Q: Definition lutz@KaPRE.COM (1995-04-28)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) jgmorris@cs.cmu.edu (Greg Morrisett) (1995-04-29)
[19 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: Charles Fiterman <cef@geodesic.com>
Keywords: syntax
Organization: Geodesic Systems
References: 95-04-013 95-04-107
Date: Wed, 19 Apr 1995 13:22:11 GMT

Semicolons are not only just a habit, they are a very bad habit.


In one study a large amount of C code was scanned for lines without
semicolons. It excluded things like fun_call(a,
b);
To look only for expressions on more than one line. It seems that
about a fourth of the lines found were errors. The missing semicolon
was simply wrong about one fourth of the time. Clearly C would be
better off with no semicolon and with a rule allowing continued lines.
Perhaps new line ends a statement except within an open (), or [].


Further I find {} silly. Everyone in their right mind indents. Count
indentation from the leftmost character of the previous line. Either
eliminate tabs as valid within programs or give them some standard
meaning like a tab takes you to the nearest 4's boundary. I would
prefer eliminating from the language, this doesn't mean editors
couldn't use tab as a command to put in spaces.


This means we could write
if x < y
cout << "hello world\n"
cin >> i


Instead of
if (x < y) {
cout << "hello world\n";
cin >> i;
}


The former is obviously a lot cleaner and eliminates a lot of style
disputes. Further it eliminates the common error where {} are
forgotten and the user forgets that indentation is not syntax.
Lines and indentation are the most obvious parts of code, the
compiler should see them too.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.