[OT] indentation, was re: [OT] Chinese Syntax

From: Arthur J. O'Dwyer (ajo_at_nospam.andrew.cmu.edu)
Date: 05/31/04


Date: Mon, 31 May 2004 12:41:54 -0400 (EDT)


On Mon, 31 May 2004, ozbear wrote:
>
> redfloyd11@yahoo.com (red floyd) wrote:
> > Dan.Pop@cern.ch (Dan Pop) wrote:
> > > None of the programming languages assigning semantics to indentation
> > > has ever become mainstream. There must be a reason...
> >
> >Not true. You're living in the present. In the past, when punch card
> >input was the norm, indentation had a meaning. In particular, FORTRAN
> >IV required input to begin in column 7 [...], with a '*' in
> >column [six] as continuation...
>
> Cobol also (originally) used column-positional syntax, Area A,
> Area B, and so on.
>
> Columns 1 through 6 (or 7) was for sequence numbers, followed by
> Area A for paragraph names, and Area B for code, but its been a long
> time.
>
> At any rate, Dan is incorrect.

  No, as far as I can tell Dan is correct in this case (depending
on your definition of "mainstream"). Neither Fortran nor COBOL were
*free-form* languages, but they certainly weren't indentation-sensitive.
See the RPG language for another slightly more modern (but much less
"mainstream") example, IIRC.

  Fortran was not indentation-sensitive; in fact, one of the most
widespread anecdotes about Fortran is the "DO20I = 1.10" incident,
which hinges on the fact that Fortran didn't recognize anything
special about whitespace *at* *all*! You could write[1]

    C WITH INDENTATION
          DO 50 I=1, 99
              BOTTLS = 100-I
              PRINT 10, BOTTLS
    10 FORMAT(1X, I2, 31H BOTTLE(S) OF BEER ON THE WALL.)
    50 CONTINUE
          STOP
          END

or equally

    C WITHOUT ANY INDENTATION
          DO 50 I=1, 99
          BOTTLS = 100-I
          PRINT 10, BOTTLS
    10 FORMAT(1X, I2, 31H BOTTLE(S) OF BEER ON THE WALL.)
    50 CONTINUE
          STOP
          END

  The fact that punch cards in the Good Old Days Before I Was
Born(TM) had designated areas in which it was okay to punch holes
representing code, or line numbers, or comments, has nothing to
do with the concept of "indentation."
  See thread
http://groups.google.com/groups?threadm=c6d30b$so4$1@online.de
in comp.lang.misc for some discussion tangentially related to
this topic. In fact, I'd suggest this whole discussion move
there, if you want to keep arguing about what's "indentation"
and what's not. Followups set.

-Arthur

[1] - Shamelessly nicked from the 99 Bottles of Beer project
and shortened with a blunt instrument. No warranties on
correctness.



Relevant Pages

  • Re: Python indentation deters newbies?
    ... >had previous encounters with FORTRAN IV, ... Not sure if I'm an unqualified newbie, but I'm a relative Python ... When I first encountered Python's indentation, ...
    (comp.lang.python)
  • Re: [OT] Chinese Syntax
    ... You're living in the present. ... >input was the norm, indentation had a meaning. ... In particular, FORTRAN ... At any rate, Dan is incorrect. ...
    (comp.lang.c)
  • Re: [OT] Chinese Syntax
    ... You're living in the present. ... >input was the norm, indentation had a meaning. ... In particular, FORTRAN ... At any rate, Dan is incorrect. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: [OT] Chinese Syntax
    ... In particular, FORTRAN ... >At any rate, Dan is incorrect. ... None of these examples count as indentation being semantically ... I've used both fixed format Fortran and fixed format assemblers, ...
    (comp.lang.c)
  • Re: [OT] Chinese Syntax
    ... You're living in the present. ... In the past, when punch card ... input was the norm, indentation had a meaning. ... It's been nigh onto 25 years since I've done FORTRAN IV. ...
    (microsoft.public.dotnet.languages.csharp)