Is it true that the actions that are possible when a program is executed in a traditional language are set in imperative form? If so, is it possible to build programs using the indicative mood? Or maybe they (the actions in the statement) are already used in any programming languages, adding elegance and efficiency to the code?

The indicative mood expresses an action that actually exists, existed or will exist (bought, read); verbs in the indicative mood have the forms of tense (present, past and future), person (1,2 and 3) and number (singular or plural);

UPD . ( Nepejvoda N. N. , Skopin I. N. Basis of programming. - 2003, page 113)

PS I did not cite the source immediately, because I did not directly quote it. Just put on an interesting question for ruSO.

Closed due to the fact that it is necessary to reformulate the question so that it was possible to give an objectively correct answer to the participants of Mike , user194374, Vladimir Gamalyan , Kromster , vp_arth 25 Feb '17 at 10:02 .

The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • five
    I read it as a "stinging mood", and already rushed to write that I was constantly doing it - Igor
  • I do not think that in the programs at least as indicated inclination. Compared to English programs are written in the shortest possible formulations. portions of speech that could unambiguously determine the inclination are discarded. And the simplest construction "if (i> 0) print i;" I see it as "if i is greater than zero, then type i", and not as "type i" - Mike
  • one
    Read the source you indicated. There the author answers in detail the question he posed. Although it is not even a question, it is an introductory text for a better perception of a subsequent topic about non-traditional (read apparently as not mandatory ) languages. Inclination in itself (in that context) does not play a role in general. And the answer is yes, there are many non-imperative languages ​​that are good for solving problems for which they are created and to know at least about the existence of which is necessary - Mike
  • one
    BDD-style testing using Cucumber demonstrates this use of language ( The Truth about BDD ). Consider this as an example of a DSL declarative style. - jfs
  • one
    Here is an article that mentions possible reasons why the narrative style (Gherkin) even for tests is not widely used. Although the development of tools supporting this approach such as behave is quite active - jfs

2 answers 2

nevertheless supplement the question with examples of your own made-up language

"I am reading a book" reflects the current state -> welcome to state machines

"I read the book" statistical information, database logs, system history, active semantics (executable code) is not invented, rather it should be a data description language, for example, some logical conclusion is made: such as the user had access to these files, we plan to check whether he spoiled them

"I will read a book" or "I want to read a book" - languages ​​for planning systems, task management, financial analysis and logistics are clearly visible: "I can turn the screws from eight to five, if I am taken to work by taxi," there is a security hole in myblin package, "tomorrow you need to run a disk check"

  • imperative programming - clearly imperative

  • there is also a declarative one - we describe what needs to be obtained, the development system builds a 1+ solution that satisfies the specified conditions and restrictions (including programming in constraints: the variables have the following range, satisfy this system of equations, optimize these values, output code generate the entire existing matrix of mainstream platforms / programming languages, you can use such libraries in the target code): it looks like an indicative mood?

there is still any strange and mixed declarative / imperative

programming through rule sets, for example, the description of a finite state machine in the form of a set of rules, transition conditions between them, input / output interfaces, code executed during transition / entry / exit from states

data transformation languages: set of declarative templates input structure -> output structure + functional parts of the rules for direct conversion

grammar description languages ​​for parser generators: unequivocally indicative, there are no initial data to parse, but the possible structural relationships between elements are already determined, but often each rule is supplemented with a piece of imperative or functional code: what exactly should be done with the found elements, how to group them or transform .

purely logical languages ​​like Prolog

Knowledge Description Languages, Semantic Networks, Minsky Frame Networks - include the active part, for example, descriptions of algorithms in general form that can be used as a template for generating code, or higher-order algorithms: algorithms for converting algorithms

    Yes, most likely true. Since all (or most) programming languages ​​use English, then:

    In order to put the verb in the imperative, we use the infinitive without particle to.

    As you can see, all verbs in programming use only the imperative mood (print, show, add, and so on.)

    You can write a program using only nouns, but there are simply no commands in the indicative mood.

    • one
      wait, how are there no commands in the indicative mood? And this is what - "Mouth closed!" (I'm in shock today) - Igor
    • @Igor, if in the sense of "He shut his mouth!", Then yes, but it seems that such emotional forms are regarded as imperative about the rules (here you can bring "Everyone, sit down!" Or "Lie down!"). - NekoDev
    • @Mike, after all, I noticed that there are no programs with indicative verbs and offered to write down nouns. But there are a lot of verbs in general, which allows conclusions to be drawn. - NekoDev
    • one
      In the expression go to label hardly a label is a verb) - vp_arth
    • @Mike, I gave a few in the answer (print, show, add). "goto" - "go_to", i.e. "to" here does not indicate the infinitive, but is a pretext ("go to ", "go to ", so "gotoScene ()" = "go to the stage"). - NekoDev