What is Type: Definition and 952 Discussions

In programming languages, a type system is a logical system comprising a set of rules that assigns a property called a type to the various constructs of a computer program, such as variables, expressions, functions or modules. These types formalize and enforce the otherwise implicit categories the programmer uses for algebraic data types, data structures, or other components (e.g. "string", "array of float", "function returning boolean"). The main purpose of a type system is to reduce possibilities for bugs in computer programs by defining interfaces between different parts of a computer program, and then checking that the parts have been connected in a consistent way. This checking can happen statically (at compile time), dynamically (at run time), or as a combination of both. Type systems have other purposes as well, such as expressing business rules, enabling certain compiler optimizations, allowing for multiple dispatch, providing a form of documentation, etc.
A type system associates a type with each computed value and, by examining the flow of these values, attempts to ensure or prove that no type errors can occur. The given type system in question determines what constitutes a type error, but in general, the aim is to prevent operations expecting a certain kind of value from being used with values for which that operation does not make sense (logic errors). Type systems are often specified as part of programming languages and built into interpreters and compilers, although the type system of a language can be extended by optional tools that perform added checks using the language's original type syntax and grammar.

View More On Wikipedia.org
  1. F

    A Physics Question. No calculations Involved here. General Theory Type

    Just two general theory types of questions: 1. Is an object that undergoes circular motion accelerating? Is a force needed for this? Where does the force come from when something is moving in a circular motion? What is the name of this force? 2. For a car going around a flat curve, what...
  2. C

    Can Magnetic Tape Be Used as an External Storage Device for PCs?

    what if you put ram chips in the hard drive itself to store information on it with the normal drive.what you could do is store windows and private files you don't want people to access when your on line there.and go between them on you computer.so if your hard drive crashes.you can boot windows...
Back
Top