ITWissen.info - Tech know how online

Typing

In the context of data types, typing is differentiated into static and dynamic typing. With static typing, the type information is added by the compiler when the program code is translated. In contrast dynamic type information of a variable results only at the run time.

Basic for the understanding of the different kinds of the Typisierung is the distinction of the terms type, value and (variable) Identifikator. A (variable) identifier (variable for short) designates something that can be manipulated. From a programming point of view, a value describes the current content of a memory area that is assigned to a variable.

Programming languages are divided into two classes according to the role that typing plays in this: statically and dynamically typed languages. Static means here that already during the translation of the program code by the compiler certain type information can be evaluated. In contrast, dynamic means here that only at runtime of the program the runtime system evaluates this type information.

In statically typed programming languages such as PASCAL, MODULA, the programming languages C++ndC++, a type is just assigned to the variables in an explicit declaration and determines how the value of a variable can be interpreted and manipulated. In dynamically typed programming languages like LISP, SMALLTALK and Python) this is just not the case. There, the type information is not stored with the variable declaration, but the value of a variable contains its type information. The equation of the variable with its value (e.g. "variable is an int value") is no longer possible here. Now it must be interpreted: "at a certain point of the program flow the variable has an int-value". A consequence of this is that variables or function arguments can take values of different types during runtime and then be manipulated differently according to the value assignment.

Functions can now be programmed to perform different actions depending on the typing of their arguments (e.g., "+" on int arguments is defined differently than on real arguments and returns different values of types as function values). Such variables, arguments and functions are called polymorphic ("multiform").

With the advantages of the two types of typing (static and dynamic) efficiency and error detection on the one hand are opposed to the flexibility of the program development on the other hand.

Informations:
Englisch: Typing
Updated at: 26.06.2017
#Words: 380
Links: indium (In), data, information, compiler, program
Translations: DE
Sharing:    

All rights reserved DATACOM Buchverlag GmbH © 2024