What are the elements that combine to obscure the definitions of programming language operations?

Compiler DesignProgramming LanguagesComputer Programming

The set of operations defined for a data type decided how data objects of that type can be manipulated. The operations can be primitive operations, which defines they are stated as an element of the language definition or they can be programmer-defined operations, as an element of class definitions.

An operation is a mathematical function, for a given input argument and it has a clear and simply persistent result. Each operation has a domain (the set of possible results that it can create). The action of the operation represents the results created for any given set of arguments.

The elements that combine to obscure the definition of programming language operation are as follows −

  • Operations that are undefined for specific inputs − An operation that is defined over some domain can be undefined for specific inputs in the domain. For example, the square root function on the negative integer domain. The explicit domain on which an operation is undefined can be intensely complex to define, as, the sets of numbers generate underflow or overflow in arithmetic operations.

  • Implicit arguments − An operation in a program regularly is invoked with a set of explicit arguments. The operation can create different implicit arguments through the use of global variables or other non-local identifier references. The entire determination of all the data that can influence the result of an operation is obscured by such implicit arguments.

For example, in C language

int sum ();
int a = 10, b = 20;
main () {
   int s;
   s = sum ();
   printf("%d", s);
}
int sum (){
   return (a+b);
}
  • Side-effect (Implicit results) − An operation can return an explicit result, as in the sum returned as the result of an addition, but it can also change the values saved in multiple data objects, both programmer and system-defined. Such implicit results are defined as side-effects.

  • Self-modification (History sensitivity) − An operation can change its internal architecture, either local data that are maintained between implementations or its code. The results created by the operation for a specific set of arguments then depend not only on those arguments but on the complete history of previous calls during the evaluations and the arguments given at each call. The operation is history-sensitive in its actions.

An example is the random number generator found as an operation in some languages. Self-modification through converts in local data received between calls is ordinary, self-modification through a change in the code of an operation is less ordinary but possible in languages including LISP.

raja
Updated on 23-Oct-2021 11:13:50

Advertisements