Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1000

Re: Programming language and IDE design

From "BartC" <bc@freeuk.com>
Newsgroups comp.compilers
Subject Re: Programming language and IDE design
Date 2013-10-19 22:05 +0100
Organization virginmedia.com
Message-ID <13-10-017@comp.compilers> (permalink)
References <13-10-016@comp.compilers>

Show all headers | View raw


"Martin Ward" <martin@gkc.org.uk> wrote in message

> (3) Indentation helps the reader if it is consistent: so should also
> be enforced by the compiler. In line with point (2), nesting should
> be defined by *both* indentation *and* grouping keywords:
> with the compiler enforcing consistency between the representations.
> This means that the reader can rely on either indication of nesting,
> since both are reliable.

> [On the other hand, having recently written a lot of python code, I've
> come around to the opinion that enforced indentation is all the grouping
> you need. -John]

Grouping provides useful extra redundancy and inspires more confidence in
the reader of the code. Example:

s1           # statement 1
if cond:
   s2
   s3
   s4
s5
s6

An accidental press of Delete before s4 removes the tab (although I've used
spaces for usenet purposes. And if usenet has also eaten those spaces, then
s2, s3 and s4 should be indented). Now the code still compiles, but doesn't
do the same thing:

s1
if cond:
   s2
   s3
s4
s5
s6

Compare with a version using begin-end grouping:

s1
if cond then
   s2
   s3
   s4
end if
s5
s6

It still works correctly whether there's a tab in front of s4 or not. The
presence of the 'end if' reinforces that belief that s4 is part of the
conditional block.

Transmission often removes tabs, or mixes up tabs and spaces, or removes
what it thinks is superfluous white space altogether.

--
Bartc
[Chacun
   a
  son
     gout
 -John]

Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Programming language and IDE design Martin Ward <martin@gkc.org.uk> - 2013-10-17 11:06 +0100
  Re: Programming language and IDE design "BartC" <bc@freeuk.com> - 2013-10-19 22:05 +0100
    Re: Programming language and IDE design Martin Ward <martin@gkc.org.uk> - 2013-11-07 19:40 +0000
      Re: Programming language and IDE design glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-11-08 05:21 +0000
      Re: Programming language and IDE design Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2013-11-08 06:45 +0100
      Re: Programming language and IDE design George Neuner <gneuner2@comcast.net> - 2013-11-08 16:04 -0500
      Re: Programming language and IDE design "Jonathan Thornburg" <jthorn@astro.indiana.edu> - 2013-11-10 04:41 +0000
  Re: Programming language and IDE design Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2013-10-20 03:22 +0200
  Re: Programming language and IDE design Gene Wirchenko <genew@telus.net> - 2013-10-20 14:03 -0700
    Re: Programming language and IDE design Gene Wirchenko <genew@telus.net> - 2013-10-21 14:44 -0700
  Re: Programming language and IDE design George Neuner <gneuner2@comcast.net> - 2013-10-22 16:17 -0400
    Re: Programming language and IDE design Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2013-10-23 03:40 +0200
    Re: Programming language and IDE design wclodius@earthlink.net (William Clodius) - 2013-10-22 19:56 -0600
    Re: Programming language and IDE design "BartC" <bc@freeuk.com> - 2013-10-23 19:09 +0100
      Re: Comments, was Programming language and IDE design "BartC" <bc@freeuk.com> - 2014-08-01 13:15 -0400
    Re: Programming language and IDE design Stefan Monnier <monnier@iro.umontreal.ca> - 2013-10-24 10:55 -0400
      Re: Programming language and IDE design George Neuner <gneuner2@comcast.net> - 2013-10-24 19:57 -0400

csiph-web