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

cg@Myrias.AB.CA
Thu, 27 Apr 1995 14:57:56 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 of a scripting lang.) jgmorris@cs.cmu.edu (Greg Morrisett) (1995-04-29)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) J.C.Highfield@loughborough.ac.uk (1995-04-30)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) mitchell@mdd.comm.mot.com (1995-04-30)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) daveb@perth.DIALix.oz.au (1995-04-30)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) anw@maths.nottingham.ac.uk (Dr A. N. Walker) (1995-05-02)
[14 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: cg@Myrias.AB.CA
Keywords: design
Organization: Myrias Computer Technologies
References: 95-04-013 95-04-147
Date: Thu, 27 Apr 1995 14:57:56 GMT

Charles Fiterman <cef@geodesic.com> writes:
      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.


The former may be easier on the eye, but I see some problems with
trying to do that, especially in C (or C++ as in the example). First,
I could no longer use the convention of putting temporary (e.g.
debugging prints) code at column 1 in the middle of normally indented
stuff. I would have to have some other convention, such as an added
comment, for finding such things. The non-indented stuff is very easy
to see.


I had initially thought that multi-line macros would be a problem, but
since they are actually only one logical line, I think they would be OK.


I personally go out of my way to avoid lines that don't fit in a standard
80-column window, so I sometimes outdent long strings constants. This
would be messed up, too.


Long expressions in general become more of a problem. Artificial rules
such as requiring extra parentheses in them are destined to cause
problems for users, automatic pretty-printers, etc.


--
Chris Gray cg@myrias.ab.ca [C macros - a powerful way to make bugs!]
Myrias Computer Technologies Inc. (403) 463-1337
--


Post a followup to this message

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