[comp.lang.misc] improve world by dropping languages with ;

john@mingus.mitre.org (John D. Burger) (02/23/91)

oz@yunexus.yorku.ca (Ozan Yigit) writes:
>dww@math.fu-berlin.de (Debora Weber-Wulff) writes:
>
>>Now what do I do about statements like
>>
>>  a := b
>>       + c ?
>
>I am not sure what you mean. What is there to do? ``a := b'' statement is
>complete, and the ``+ c'' statement is in error, at least in most of the
>languages I know of that do away with the semicolon. In such languages
>[e.g. Icon, Bell Labs S etc] a statement is allowed to continue only when
>it is clear that the end of the expression cannot have occurred yet. In
>practice, this is easy to implement, and works rather well.
>
>oz
>---
>Why should the status of my code depend on  | Internet: oz@nexus.yorku.ca
>what RMS had for breakfast? -- Jay Maynard  | Uucp: utzoo/utai!yunexus!oz

How can anyone stand to program in a language where whitespace matters
in this way?  Why should the status of my code depend on whitespace?
--
John Burger                                               john@mitre.org

"You ever think about .signature files? I mean, do we really need them?"
  - alt.andy.rooney

rcd@ico.isc.com (Dick Dunn) (02/23/91)

john@mingus.mitre.org (John D. Burger) writes:
> How can anyone stand to program in a language where whitespace matters
> in this way?  Why should the status of my code depend on whitespace?

Probably people don't mind programming in a language where whitespace
matters because they also write in natural languages where whitespace
matters.

In fact, one relatively common form of bug in languages where whitespace
doesn't matter is where the layout of the program doesn't reflect the
syntactic structure.  Human readers miss the bug precisely because they
*do* care about the whitespace, even more than about the punctuation.
For example, in C:
	if (x<0)
		fprintf(stderr, "blah blah babble %f\n", x);
		exit(1);
Many people will have to look at this several times to figure out why the
program exits here regardless of the value of x, because they see the
whitespace and ignore the punctuation.

I think it would be a step forward to move human and compiler
interpretation of code closer together.
-- 
Dick Dunn     rcd@ico.isc.com -or- ico!rcd       Boulder, CO   (303)449-2870
   ...But is it art?

sane@cs.uiuc.edu (Aamod Sane) (02/24/91)

rcd@ico.isc.com (Dick Dunn) writes:

>john@mingus.mitre.org (John D. Burger) writes:
>> How can anyone stand to program in a language where whitespace matters
>> in this way?  Why should the status of my code depend on whitespace?

>Probably people don't mind programming in a language where whitespace
>matters because they also write in natural languages where whitespace
>matters.

>In fact, one relatively common form of bug in languages where whitespace
>doesn't matter is where the layout of the program doesn't reflect the
>syntactic structure.  Human readers miss the bug precisely because they
>*do* care about the whitespace, even more than about the punctuation.
>For example, in C:
>	if (x<0)
>		fprintf(stderr, "blah blah babble %f\n", x);
>		exit(1);
>Many people will have to look at this several times to figure out why the
>program exits here regardless of the value of x, because they see the
>whitespace and ignore the punctuation.

>I think it would be a step forward to move human and compiler
>interpretation of code closer together.
>-- 

This is what the emacs language-specific editing does. I have often
been stopped by the editor misalignment to take a good look at
what I just wrote. 

Incidentally, I remember a paper in IEEESoftware I think where someone
was making editors directly from the grammar specs. Any news about
such things? Did'nt some of the Mac Pascal compilers used to do this?

The next step was to be incremental compilation of the language in the 
background.

Aamod Sane
-- 
sane@cs.uiuc.edu
         ==         / \  
-----    ==    *    \_/     -|||- 
         ==     

guido@cwi.nl (Guido van Rossum) (02/26/91)

If you want to see for yourself what the advantagesare of using
indentation for grouping, you can now fetch the brand new Python
language from alt.sources or an archive (it is stored in pub in
wuarchive.wustl.edu) and learn Python -- an alternative to Perl with
reasonable syntax, if I may say so.

--
Guido van Rossum, CWI, Amsterdam <guido@cwi.nl> --Author of Python--
"It's a bit runny, sir"

john@mingus.mitre.org (John D. Burger) (02/26/91)

new@ee.udel.edu (Darren New) writes:
> Actually, in my experience, most beginners get the indentation correct
> more often than the begin-end matching.  Why shouldn't the status
> depend on whitespace if it is more asthetically pleasing?  Other
> than *maybe* making it easier for automated sorce-transformation
> tools, why require that only a semicolon end a statement, and not a
> semicolor or EOL?

I don't want to require ANYTHING with respect to whitespace, except
that it be used to separate tokens, WHERE NECESSARY.  Don't get me
wrong, however, I have very strong intuitions about stylistic things
like indenting.  One of these intuitions is that it's impossible to
legislate style.

rcd@ico.isc.com (Dick Dunn) writes:
> Probably people don't mind programming in a language where
> whitespace matters because they also write in natural languages
> where whitespace matters.

In written natural language, whitespace can HELP understanding, but it
is not REQUIRED for understanding.  (BTW, what about speech?)  Also,
you're clearly talking about western written languages, as opposed to
something like Japanese, which doesn't always use whitespace to
separate words.

On the other hand, I don't have strong intuitions about semicolons,
because I'm used to programming in languages like Lisp that don't
really have the concept of "statements".

--
John Burger                                               john@mitre.org

"You ever think about .signature files? I mean, do we really need them?"
  - alt.andy.rooney

new@ee.udel.edu (Darren New) (02/26/91)

In article <1991Feb23.233234.3480@m.cs.uiuc.edu> sane@cs.uiuc.edu (Aamod Sane) writes:
>Incidentally, I remember a paper in IEEESoftware I think where someone
>was making editors directly from the grammar specs. Any news about
>such things? Did'nt some of the Mac Pascal compilers used to do this?
>
>The next step was to be incremental compilation of the language in the 
>background.

Well, here's the biblio entry I have for the Cornell Synthesizer,
which takes an attributed grammar and generates a context-sensitive
editor for it.  I also use a compiler written in the synthesizer.
I don't know that it does any background work, but I think they are
working on it.

 
 @book{Reps87,
	 author = "T. Reps and T. Teitelbaum",
	 title = "The Synthesizer Generator Reference Manual",
	 publisher = "Deparment of Computer Science, Cornell University",
	 month = jul,
	 year = 1984
	 }


-- 
--- Darren New --- Grad Student --- CIS --- Univ. of Delaware ---
----- Network Protocols, Graphics, Programming Languages, 
      Formal Description Techniques (esp. Estelle), Coffee, Amigas -----
              =+=+=+ Let GROPE be an N-tuple where ... +=+=+=

guido@cwi.nl (Guido van Rossum) (02/26/91)

john@mingus.mitre.org (John D. Burger) writes:

>I have very strong intuitions about stylistic things
>like indenting.  One of these intuitions is that it's impossible to
>legislate style.

Oh?  I've never heard anybody request the right to define their own
string quotes or reserved words (for example) in a programming
language.  You take what the language gives you, period.  Why is it
that rules for the use of whitespace provoke such strong reactions?
Could it be a knee-jerk reaction of the kind "the rules for lay-out in
Fortran, Basic and Assembler (for example) are wrong, therefore all
languages with rules for lay-out are wrong" ?

For those who take the worn-out word "freedom" in their mouth in
response to this, think about strong typing.  Strong typing reduces
your freedom as a programmer.  Is this necessarily bad?
--
Guido van Rossum, CWI, Amsterdam <guido@cwi.nl>
Honary Member, Royal Society for Putting Things on Top of Other Things

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (02/26/91)

In article <3021@charon.cwi.nl> guido@cwi.nl (Guido van Rossum) writes:
: If you want to see for yourself what the advantagesare of using
: indentation for grouping, you can now fetch the brand new Python
: language from alt.sources or an archive (it is stored in pub in
: wuarchive.wustl.edu) and learn Python -- an alternative to Perl with
: reasonable syntax, if I may say so.

You may say so.

I personally think Perl's syntax is reasonable, but tastes do differ.  I've
certainly never claimed that Perl was beautiful.  But you can write
beautiful poetry in an ugly language--look at English.

Larry Wall
lwall@jpl-devvax.jpl.nasa.gov

new@ee.udel.edu (Darren New) (02/26/91)

In article <3024@charon.cwi.nl> guido@cwi.nl (Guido van Rossum) writes:
>Oh?  I've never heard anybody request the right to define their own
>string quotes or reserved words (for example) in a programming
>language.  

Then you haven't worked much in LISP or FORTH, have you?  Both of these
have functions for parsing strings (as well as other things).
       -- Darren

-- 
--- Darren New --- Grad Student --- CIS --- Univ. of Delaware ---
----- Network Protocols, Graphics, Programming Languages, 
      Formal Description Techniques (esp. Estelle), Coffee, Amigas -----
              =+=+=+ Let GROPE be an N-tuple where ... +=+=+=

gudeman@cs.arizona.edu (David Gudeman) (02/26/91)

In article  <3024@charon.cwi.nl> Guido van Rossum writes:

]For those who take the worn-out word "freedom" in their mouth in
]response to this, think about strong typing.  Strong typing reduces
]your freedom as a programmer.  Is this necessarily bad?

Yes.
--
					David Gudeman
gudeman@cs.arizona.edu
noao!arizona!gudeman

spg@alpha.sunquest.com (Steve Gibbons) (02/26/91)

In article <550@coatimundi.cs.arizona.edu>, gudeman@cs.arizona.edu (David Gudeman) writes...
#In article  <3024@charon.cwi.nl> Guido van Rossum writes:
# 
#]For those who take the worn-out word "freedom" in their mouth in
#]response to this, think about strong typing.  Strong typing reduces
#]your freedom as a programmer.  Is this necessarily bad?
                                         ^^^^^^^^^^^
# 
#Yes.
#--
#					David Gudeman
#gudeman@cs.arizona.edu
#noao!arizona!gudeman
The key word being necissarily, of course.  Should I tell you about MUMPS?
"No."  You say...
MUMPS, Don't ask me what it stands for (Something about Massechusets General
Hospital...)  _is_ an ansi standard language.  Like several (many/a few) other
languages, it primarily supports "strings."  (numbers [whether ints or floats]
are stored as strings and converted at computation time).

Anyway, a situation that occurred (once) is that line noise accidentally
embedded an "E" in a number, "no big deal" you say, "that's not a number. 
That's alphanumeric."  But this field just happened to look something like
"99E123455678901234" which the application attempted to convert to scientific
notation, a float.  It bombed with an "out of range" message.  (In a big way)

Off topic?  Maybe.  Sue me.  ;-)

Sven
 ___________________________________________________________________________
| Steve Gibbons, H.I.S. Interfacing | 602/885-7700x2649 or 602/296-8936(Fax)|
|   Sunquest Information Systems    |  spg@{alpha|nereid|beta}.sunquest.com |
|   930  N. Finance Center Drive    |---------------------------------------|
|   Tucson, Arizona   85710-1343    | "It's Late.  I'm Tired.  (Sorry...)"  |
 ---------------------------------------------------------------------------

kers@hplb.hpl.hp.com (Chris Dollin) (02/26/91)

Guido van Rossum writes:

   john@mingus.mitre.org (John D. Burger) writes:

   >I have very strong intuitions about stylistic things
   >like indenting.  One of these intuitions is that it's impossible to
   >legislate style.

   Oh?  I've never heard anybody request the right to define their own
   string quotes or reserved words (for example) in a programming
   language.  You take what the language gives you, period.  

You can (and I do) define your own keywords in Pop11. Defining your own string
quotes would be harder (because the tokenisation procedure is a constant, not a
variable, and writing tokenisers is boring).

And there's Forth, too: you can define your own keywords there (loosely
speaking, anyway; they're just "ordinary" words to Forth).

Lisp macros are (in a reasonable sense) equivant to new keywords (ie, they can
introduce new language constructs).

That's three languages which given counterexamples of varying strengths. Any
more? 

--

Regards, Kers.      | "You're better off  not dreaming of  the things to come;
Caravan:            | Dreams  are always ending  far too soon."

cet1@cl.cam.ac.uk (C.E. Thompson) (02/26/91)

In article <1991Feb22.211643.12151@linus.mitre.org> john@mingus.mitre.org (John D. Burger) writes:
>
>How can anyone stand to program in a language where whitespace matters
>in this way?  Why should the status of my code depend on whitespace?
>--
Howcanyoustandtopostarticlesinalanguagewherewhitespacematters?

Chris Thompson
JANET:    cet1@uk.ac.cam.phx
Internet: cet1%phx.cam.ac.uk@nsfnet-relay.ac.uk

miles@cogsci.ed.ac.uk (Miles Bader) (02/27/91)

john@mingus.mitre.org (John D. Burger) writes:
> oz@yunexus.yorku.ca (Ozan Yigit) writes:
> >dww@math.fu-berlin.de (Debora Weber-Wulff) writes:
> >
> >>Now what do I do about statements like
> >>
> >>  a := b
> >>       + c ?

> How can anyone stand to program in a language where whitespace matters
> in this way?  Why should the status of my code depend on whitespace?

rcd@ico.isc.com (Dick Dunn) writes:
> Probably people don't mind programming in a language where whitespace
> matters because they also write in natural languages where whitespace
> matters.

> I think it would be a step forward to move human and compiler
> interpretation of code closer together.

The quoted code fragment above used whitespace (extra indentation) to
indicate that the statement was continued.  Don't try and automagically guess
the programmer's intent using such traditionally fuzzy things like whitespace
unless you can do more than a half-assed job of it (like the viable-EOS/EOL
rule).

-Miles
--
--
Miles Bader  --  HCRC, University of Edinburgh  --  miles@cogsci.ed.ac.uk

aipdc@castle.ed.ac.uk (Paul Crowley) (03/01/91)

I spend enough time putting in missed semicolons into programs to like
the idea of a whitespace dependant language.  But I recoil in horror
from some of the consequences.  In particular, there are many software
packages that regard whitespace as fair game.  I wouldn't feel safe
looking at a printout, thinking "maybe that crufty old printer munged
the whitespace, and it isn't that at all."

That's why I want whitespace significance implemented as a pair of
filters.  It's more natural that way anyway, it makes the job of the
compiler easier, and you get to look at code whose meaning has
considerably less scope for uncertainty.  (Uncertainty on my part, not
mathematical (or physical) uncertainty).

Hell, why not please everybody? What's wrong with the best of both
words? It doesn't suffer from the usual difficulty with making something
optional, that being that you only have to write one form but must
understand both, because you can understand one and use one of the pipes
on code in the form of the other.  Me, I'd use both.  "Now, do I tab
that in, or leave it on the same line?  Let's see how it parses it..."
                                         ____
\/ o\ Paul Crowley aipdc@uk.ac.ed.castle \  /
/\__/ Trust me.  I know what I'm doing.   \/

tchrist@convex.COM (Tom Christiansen) (03/03/91)

From the keyboard of cet1@cl.cam.ac.uk (C.E. Thompson):
:In article <1991Feb22.211643.12151@linus.mitre.org> john@mingus.mitre.org (John D. Burger) writes:
:>
:>How can anyone stand to program in a language where whitespace matters
:>in this way?  Why should the status of my code depend on whitespace?
:>--
:Howcanyoustandtopostarticlesinalanguagewherewhitespacematters?

Don't be silly.  We don't want Fortran.  But these should all be
the same.

1) How can you stand to post articles in a language where white space matters?

2) How can you stand 		to post articles in a language 
       where white space matters?

3) How can you stand 		
   to post articles 
   in a language 
   where white space 
   matters?

4) How 
    can you stand 
    to post articles 
       in a language 
	   where white space 
   matters?

Separate tokens with white space, of course, but don't try to tell me
that space, tabs, and newlines are different, or that the indentation
should affect the meaning.

--tom
--
"UNIX was not designed to stop you from doing stupid things, because
 that would also stop you from doing clever things." -- Doug Gwyn

 Tom Christiansen                tchrist@convex.com      convex!tchrist

john@mingus.mitre.org (John D. Burger) (03/06/91)

cet1@cl.cam.ac.uk (C.E. Thompson) writes:
>john@mingus.mitre.org (John D. Burger) writes:
>>How can anyone stand to program in a language where whitespace matters
>>in this way?  Why should the status of my code depend on whitespace?
>Howcanyoustandtopostarticlesinalanguagewherewhitespacematters?

This is hardly a counterexample, since we can all read this without
the whitespace.  But actually, I don't have a problem with whitespace
to separate tokens, but rather a problem with a language in which a
newline produces a different result from a space, such as the example
given by someone else:

  x := a
       + b
--
John Burger                                               john@mitre.org

"You ever think about .signature files? I mean, do we really need them?"
  - alt.andy.rooney

rbj@uunet.UU.NET (Root Boy Jim) (03/12/91)

In article <1991Mar02.200330.13408@convex.com> tchrist@convex.COM (Tom Christiansen) writes:
>
>Separate tokens with white space, of course, but don't try to tell me
>that space, tabs, and newlines are different, or that the indentation
>should affect the meaning.

Well, here are *my* *preferences*.

Given:

	I hate to type.

	Most statements are one line and vice versa

	Sometimes they aren't, and vice versa.

Conclusions:

	Newlines should terminate statements

	If you want two statements on a line,
	separate or terminate them with ;

	If you want a statement on two lines,
	continue the first with \

There is already such a beast. The shell.

So yes, newlines are somewhat different. Or if you prefer,
there is horizontal whitespace, and there is vertical whitespace.
-- 
		[rbj@uunet 1] stty sane
		unknown mode: sane