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

Re: expressions vs. statements

Paul Graham wrote:
> This is actually a question people on this list might
> have interesting opinions about.  Does distinguishing
> between expressions and statements buy you anything in
> expressive power?  I have often wondered about what
> the point of this distinction was...

Languages which distinguish between the two (and prohibit one using
them interchangably) have problems when you attempt to write macros
and higher-order functions.  You end up having to write two forms of
*everything*:  the statement and the expression version.

Consider C where a common idiom is

do { <statement>;} while (0)

to turn a statement into an expression.