| Type System |
Article Index for Type |
Website Links For Type System |
Information AboutType System |
| CATEGORIES ABOUT TYPE SYSTEM | |
| data types | |
| programming language implementation | |
| type theory | |
|
A Compiler may use the static type of a value to optimize the storage it needs and the choice of algorithms for operations on the value. For example, in many C compilers the "float" Data Type is represented in 32 Bit s, in accordance with the IEEE Specification for single-precision floating point numbers. Thus, C uses floating-point-specific operations on those values (floating-point addition, multiplication, etc.). The depth of type constraints and the manner of their evaluation affects the ''typing'' of the language. Further, a programming language may associate an operation with varying concrete algorithms on each type in the case of Type Polymorphism . Type Theory is the study of type systems, although the concrete type systems of programming languages originate from practical issues of computer architecture, compiler implementation, and language design. BASIS Assigning data types (''typing'') gives meaning to collections of Bit s. Types usually have associations either with values in Memory or with Objects such as Variables . Because any value simply consists of a set of bits in a Computer , hardware makes no distinction even between Memory Address es, Instruction Code , Characters , Integer s and Floating-point Number s. Types inform programs and programmers how they should treat those bits. Major functions that type systems provide include:
A program typically associates each value with one particular type (although a type may have more than one Subtype ). Other entities, such as Objects , Modules , communication channels, Dependencies , or even types themselves, can become associated with a type. For example: A ''type system'', specified in each programming language, stipulates the ways typed programs may behave and makes behavior outside these rules illegal. An '' Effect System '' typically provides more fine-grained control than a type system. More formally, Type Theory studies type systems. TYPE CHECKING The process of verifying and enforcing the constraints of types – ''type checking'' – may occur either at Compile-time (a static check) or Run-time (a dynamic check). If a language enforces type rules strongly (that is, generally allowing only those automatic type conversions which do not lose information), one can refer to the process as ''strongly typed'', if not, as ''weakly typed''. Static typing In most compiled computer languages, like C, C++ and Pascal, the data type of every variable, parameter and function return value is known at compile time. The programmer has to provide the type information through Declaration s. This is known as static typing (but some statically typed languages may include Implicit Declarations ). A programming language is statically typed if type checking may be performed without testing equivalence of run-time expressions. A statically typed programming language respects the distinction between run-time and compile-time phases of processing. A language has a compile-time phase if separate modules of a program can be type checked separately ( Separate Compilation ), without information about all modules that exist at run time. Static type-checking becomes a primary task of the Semantic Analysis carried out by a Compiler . Dynamic typing
|
|
|