programming language features on execution sequence

110 Views Asked by At

Not sure if I could explain my ideas clearly but let me try.

Programming language decides the execution sequence of the code.

  1. The plain example is C as a procedure programming language decides that the code execution starts from "main()" and follows the function calls on and on.

  2. Exception handling ("try...catch") is another feature, that the code execution has a "normal" sequence vs an "exception" sequence. When exception happens, the code roll up, still following the function call relationship, but skipped normal codes.

  3. TSR, win api, MFC, VBA etc define another style, that the code may have multiple entry points: execution can be triggered from a system message or a user interaction. Class design will make destructor implicitly called when an object is out of scope etc, this is another example of "multiple entry points".

  4. There are some "lazy" features allowed some code execution be postponed until it's needed. for example, in C++ istream_iterators are permitted to use lazy evaluation.

  5. There are some language features allow asynchronous execution, such as the "async" in F#.

My questions is, besides such features, are there other language features, in C++ or other languages, not coding pattern/skill, to alter the execution sequence of the code?

1

There are 1 best solutions below

0
On

The features you are after can partly be determined by the programming paradigm(s) that a particular language adheres to. A good summary about these can be found here: http://www.info.ucl.ac.be/~pvr/paradigms.html

Some lower level features (specifically item 2 in your list, exception handling) is generally discussed under the term "Control flow". According to its wikipedia page (http://en.wikipedia.org/wiki/Control_flow), it is restricted to the imperative and functional paradigms.