4 ms·
I actually see the converse often with novices often, referring to statements (or even entire function decls) as "commands".
by treyd 1y ago
I actually see the converse often with novices often, referring to statements (or even entire function decls) as "commands".
- kragen 1y ago"Command" is a better term for what we call "statements" in imperative programming languages. "Statement" in this context is an unfortunate historical term; except in Prolog, these "statements" don't have a truth-value, just an effect. (And in Prolog we call them "clauses" instead.)
- adrian_b 1y agoTrue. In many early computer programming documents the term "order" was used instead of "statement", where "order" was meant as a synonym for "command" and not as referring to the ordering of a sequence.
- kragen 1y agoOccasionally, but much more often (as in Mauchly's cited paper) an "order" was a machine instruction, not a high-level language "statement".
- adrian_b 1y agoYes, but that is mostly because in the first few years (including by the time of Mauchly), there were no "high-level" programming languages, so the "orders" composing the text of a program corresponded to instructions directly executable by the machine. I believe that the term "statement" has been imposed by the IBM publications about FORTRAN, starting in 1956. Before the first public documents about IBM FORTRAN, the first internal document about FORTRAN, from 1954, had used the terms "formula" for anything that later would be called "executable statement", i.e. for many things that would not have been called formulas either before or after that, like IF-formulas, DO-formulas, GOTO-formulas and so on, and the document had used "sentence" for what later would be called "non-executable statements" (i.e. definitions or declarations). Before FORTRAN (1951 to 1953), for his high-level programming language Heinz Rutishauser had used the term "Befehl", which means "command". (For what we name today "program", he had used the term "Rechenplan", which means "computation plan".)
- kragen 1y agoI suppose if your only tool is a formula translator, everything looks like a formula? "Plan" is really a much better term than "program". My next compiler will be called "plantran" for "plan translator". "pt" for short.
- jecel 1y agoI have named the experimental languages I am toying with "Plan <x>" (for Programming LANguage, but also because it is a good term as you pointed out). Originally I was using numbers (probably would skip "Plan 9" like Microsoft skipped Windows 9) but the experiments went in different directions and implying an order was misleading. So I switched to star names: Plan Sirius, Plan Rigel, Plan Vega...
- kragen 1y agoAre you writing up your results anywhere?
- jecel 1y agoNot yet, and if I publish any of the languages I will probably use a different name (like "Oak" -> "Java"). Though I did call the unfinished language I published "BLA" (Baby 8 LAnguage - an attempt to see if I could fit an interpreter and editor in 1KB) so I might stick with the stupid names after all. https://github.com/jeceljr/baby8/tree/main/examples/bla https://github.com/jeceljr/baby8/tree/main/examples/bla
- kragen 1y agoHmm, you might want to rename that: https://strlen.com/bla-language/ https://strlen.com/bla-language/ An interpreter and editor in 1K sounds very challenging! Do you mean 1K of Squeak bytecode? Including vectors of literals and selectors?
- 1y ago
- 9rx 1y agoIs it? "Statement", defined by the dictionary as "the expression of an idea or opinion through something other than words.", seems quite apt. Symbols may end up resembling words, which perhaps is your contention, but technically they are only symbols. Best I can tell, all usable definitions surrounding "Command" seem to suggest an associated action, which isn't true of all statements in imperative programming.
- lmm 1y ago> Best I can tell, all usable definitions surrounding "Command" seem to suggest an associated action, which isn't true of all statements in imperative programming. The defining characteristic of a programming "statement" is that it can perform some action (even if not all of them do), whereas statements in the usual everyday sense are inert. So it's not a good term.
- 9rx 1y ago> The defining characteristic of a programming "statement" is that it can perform some action Given a declaration "statement" such as: int x; What is the expected action? Memory allocation... I guess? Does any compiler implementation actually do that? I believe, in the age of type systems being all the rage, one would simply see that as a type constraint, not as a command to act upon. Expressing an idea (the values used henceforth should be integers) seems more applicable, no?
- lmm 1y ago> Given a declaration "statement" such as: > int x; > What is the expected action? In a language that requires you to declare variables before you use them, it clearly does something - you couldn't do "x = 5;" before, and now you can. If you're trying to understand the program operationally (and if you're not then why are you thinking about statements?) it means something like "create a variable called x", even if the implementation of that is a no-op at the machine code level. > I believe, in the age of type systems being all the rage, one would simply see that as a type constraint, not as a command to act upon. But in that case by definition one would not be seeing it as a statement! Honestly to me it doesn't really matter whether "int x;" is an expression, a statement, or some mysterious third thing (in the same way that e.g. forward declaring a function isn't a statement or an expression). When we're talking about the distinction between statements and expressions we're talking primarily about statements like "x = x + 1;", which really can't be understood as a statement in the everyday English sense. > Memory allocation... I guess? Does any compiler implementation actually do that? Toy/research or embedded compilers do yes.
- afiori 1y agoThe requirement for a truth value is just from how math/logic uses the term.
- kragen 1y agoWell, and linguistics. A "statement" in the grammatical sense is a sentence that is declarative in form (as opposed to, in English, interrogative, imperative, or exclamatory) and which thus ostensibly has a truth-value.