Related articles |
---|
Semicolons (Re: Low-Rent Syntax) bart@videovax.tv.tek.com (Bart Massey) (1990-08-13) |
Re: Semicolons (Re: Low-Rent Syntax) codex!peterd@uunet.UU.NET (1990-08-20) |
Semicolons (Re: Low-Rent Syntax) thomasm@llama.ingres.com (1990-08-22) |
Re: Semicolons (Re: Low-Rent Syntax) trt@rti.rti.org (1990-08-24) |
Re: Semicolons (Re: Low-Rent Syntax) mjr@decuac.DEC.COM (1990-08-25) |
Re: Semicolons (Re: Low-Rent Syntax) bart@videovax.tv.tek.com (Bart Massey) (1990-08-26) |
Re: Semicolons (Re: Low-Rent Syntax) elsie!ado@uunet.UU.NET (1990-08-27) |
[9 later articles] |
Newsgroups: | comp.compilers |
From: | Bart Massey <bart@videovax.tv.tek.com> |
Keywords: | parse, design |
Organization: | Tektronix TV Measurement Systems, Beaverton OR |
References: | <1990Aug12.205529.11691@esegue.segue.boston.ma.us> |
Date: | Mon, 13 Aug 90 21:40:01 GMT |
In article <1990Aug12.205529.11691@esegue.segue.boston.ma.us> Stephen D. Clamage <steve@taumet.com> writes:
> There has been some discussion about *how* to design languages which do
> not need semicolons to separate or end statements. No one has brought up
> why you would want to.
...
> Finally, beginning programmers are going to make all kinds of errors, for
> all kinds of reasons. For more-experienced programmers, are semicolon
> errors a real problem -- as big as other kinds of syntax errors? I'd say
> no.
Well, I'll admit it :-). I've been programming in C professionally for
about 5 years, and about 1/2 my extra trips into the editor are still to
correct missing semicolons. I almost never *add* semicolons, though.
This is true of most C programmers I know. And note that when the added
semicolon does appear, it usually takes the insidious form
x = 100;
while( x );/* a nasty case */
/*
* these comments are intended only to obscure the fact
* that the next statement will never be executed...
*/
x--;
I claim that a moment's thought tells us why it is that semis are such a big
problem in traditional languages -- we all have been taught a "structured"
style which emphasizes regular use of whitespace, but traditional compiled
languages are completely insensitive to the use of whitespace.
> One example was given of
> a = b
> + c
> as being a legal sequence of statements in one language. Almost certainly
> this was meant to be a single statement.
What made you think this? The exactly-one-assignment-statement-per-line
convention, a very common idiom across many otherwise widely different
languages (LISP and friends being the most obvious exception I can think of
offhand). And yet your compiler or interpreter probably wouldn't even
optionally whine about the above, much less refuse to generate code.
If I ever design a C-like language (which is unlikely, since C is
pretty good for this :-), it'll be spec'ed in such a way as to generate
warnings if line breaks appear in funny places, or the indentation
looks wrong. It's a bit harder to implement, but I'm just plain tired
of debugging code (of my own and others' :-) like
if( v )
w;
if( x )
y;
else /*XXX*/;
z;
Bart Massey
..tektronix!videovax.tv.tek.com!bart
..tektronix!reed.bitnet!bart
[I never found rogue semicolons to be such a problem, but I suspect that
my style uses a lot more braces than yours. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.