[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

statements vs. expressions

So far it looks as if statements are a mistake that
got made in Fortran, were inherited by Algol, and spread
thence to most other programming language.  It was
obvious why Fortran I distinguished between expressions
and statements.  Not surprisingly, considering the input
format was punched cards, Fortran I is line-oriented;
you can't compose statements.  So while you need to have
expressions for math to work, there is no point in
making everything an expression, because there could
never be anything waiting for the return value.

Of course, once you advance to block-structured languages,
there could be, but by then the expression/statement
distinction seems to have taken hold.

I'm not saying there is no benefit from this limitation.
Like any limitation, it enforces a certain consistency
in programs.  For example, Arc allows any compound data
structure to be used as a function.  One could argue
(and people probably will) that CL, where this isn't
possible, is better because it signals an error when you
do it by mistake and Arc doesn't.  Ditto for Lisp 2 vs
Lisp 1.

But, you know, if you introduce *any* limitation into
your language, it enforces more consistency.  It's still
just a limitation.  I'm willing to be convinced otherwise,
but as far as I can tell, statements seem to be just a 
long-perpetuated mistake.  

I wonder which inheritance from punched cards will last
longest, statements or 80-char lines....

Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com