Comment by kragen
5 days ago
In most programming languages, declarations aren't statements, because they don't have any effect at runtime. Maybe you can find some exceptions. Like in BASIC the DIM statement is sort of a declaration, but it does have a runtime effect; it changes the dimensions of an array. (Though some would say that in BASIC no statement is bright.)
> Maybe you can find some exceptions.
Including Ken Thompson's very own[1]. Fair enough that in the olden days there was a clearer distinction made, but even the man who (co-)created C changed his mind on that later because that is how the term has evolved. Now, in normal conversation, if you call `int x;` a statement, nobody is going to struggle to understand what you mean. Are you still living in the 1970s? If so, I admittedly missed that. My assumption was that this discussion is taking place in 2025 with the words of its time.
[1] https://go.dev/ref/spec#Statements
Your example isn't syntactically valid in Golang. Declarations are statements in Rust too, but not Python, TypeScript, or ECMAScript (which to my surprise does have a "Declaration" nonterminal in its grammar). C++, Java, and C# are half-and-half; in their grammars, some kinds of declarations (in particular, like `int x;`) can be statements, but others cannot.
The distinction hasn't gotten any less clear, but it was already easy to find people in the 01970s who didn't know the difference. You're one of today's lucky ten thousand!
I do frequently encounter people who are failing to solve their problems because they don't know things that were already known in the 01970s, so I think it's worthwhile to study 01970s informatics. Mostly, though, I think it's worth studying the zeitgeist of the 01970s in informatics: some people were making rapid progress on solving fundamental problems, partly because they didn't have certain self-defeating attitudes that are popular in informatics today, such as not caring whether what they say is true or false.
> Your example isn't syntactically valid in Golang.
Well, of course not. Hnlang is clearly not the same language as Go. The different name tips you off to that. However, the same intent can be expressed as a Go statement:
For what it is worth, the silly pedantry you offer is as funny as you had hoped it would be, so kudos. But it is telling that you had to reach for being funny to mask your cluelessness. Better than being one of those idiots that doubles down on their idiocy once they realize that they have no idea what is going on, I suppose!
3 replies →