by gumby · 3y ago · 0 comments
IMHO* a distinguishing feature of Algol like languages (aka "procedural" languages) is the distinction between expressions and statements. Though personally I've never seen the appeal, that distinction seems to be popular for some reason.
* this isn't even a quibble -- the article is fine without it. Just something that has always seemed weird to me.
But if you change your definitions such that expressions always evaluate to a single value and do not have any side effects while statements produce some kind of side effect (and may or may not yield a value), the distinction becomes important.
Especially if you believe side-effects need special handling (i.e. you are a functional programmer).
Are there any good examples of languages that have it, where it isn't "useless"?
But I think the argument being advanced is that the distinction between statements and expressions is fundamentally unnecessary. I don’t really know of any good argument in favour of them: I tend to think lisps have the perfect and simplest possible syntax.
C is less particular about the expression/statement distinction. Java enforces redundancy.
(to be fair, it took a lot of inspiration from Smalltalk and LISPs)