Related articles |
---|
Q: Definition of a scripting lang. ariel@ccs.neu.edu (1995-03-04) |
Re: Q: Definition of a scripting lang. macrakis@osf.org (1995-03-10) |
Re: Q: Definition of a scripting lang. eifrig@beanworld.cs.jhu.edu (1995-03-15) |
Re: Q: Definition of a scripting lang. lwall@netlabs.com (1995-03-27) |
Re: Q: Definition of a scripting lang. rpereda@wotangate.sc.ti.com (1995-04-05) |
Re: Q: Definition of a scripting lang. lwall@netlabs.com (1995-04-16) |
Whitespace (Was: Q: Definition of a scripting lang.) eifrig@beanworld.cs.jhu.edu (1995-04-16) |
The semicolon habit (was: Q: Definition of a scripting lang.) prechelt@i41s25.ira.uka.de (1995-04-11) |
Re: Q: Definition of a scripting lang. leichter@zodiac.rutgers.edu (1995-04-18) |
Newsgroups: | comp.compilers |
From: | rpereda@wotangate.sc.ti.com (Ramon Pereda, ) |
Organization: | Texas Instruments Inc. |
References: | 95-04-013 |
Date: | Wed, 5 Apr 1995 17:37:05 GMT |
Jonathan Eifrig <eifrig@beanworld.cs.jhu.edu> wrote:
: : Personally, I view a language as a "scripting" language if (1) whitespace
: : is significant...
:
Programming language designer, Larry Wall wrote:
: According to this criterion, Fortran was the last great scripting language. :-)
:
: Whitespace is significant in nearly all modern languages. You can't
: put whitespace inside a token in C, Ada, Modula, Lisp, Perl, etc. And
: you typically *must* put whitespace between two adjacent alphanumeric
: tokens in any of these languages.
:
: Now, if what you meant is that newlines have syntactic meaning in addition
: to their ordinary whitespace meaning, I'll grant you that many languages
: do this, including sh, awk, Tcl and Python. But not Perl. Perl doesn't
: even care if you put a newline inside a literal string. Please tar Perl
: with a different brush.
Icon has makes an interesting distinction between whitespace and newlines.
Newline automatically inserts a semicolon at the end of a line,
if an "expression" ends on that line and the next line begins with another.
For the sake of this discussion, just think of "expressions" as statements.
As a result, the following three sets of statements are all equivalent:
i := 2;
j := 5;
k := 7;
i := 2
j := 5
k := 7
i := 2; j := 5; k := 7
Forgetting a trailing semicolon is a common goof in a variety of languages
such as Perl, Ada, Pascal, and C. I see pitfalls like this as flaws in the
language, not the novice programmer. Perhaps his semi-conscious act of leaving
out the semicolon has a natural elegance. Programming language designers
should not beat this innate habit out of the novice programmer. I don't have
any hard rules for justifying leaving out the semicolons. I just appeal to
your intuitions (when you FIRST STARTED programming if you can think back that
far). Isn't simpler? Less clutter?
The semicolon pitfall is pervasive and very easy to remedy. Now, if only
English were as easy to fix...
---
Ray Pereda
rpereda@tools.micro.ti.com
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.