Primitive (built-in, basic) type - data type provided by the programming language as the basic built-in unit of the language.
Depending on the language and its implementation, the set of these types can vary greatly. It is determined by the requirements for the simplicity of the language and the compiler ( interpreter ), implementation efficiency, features of the language application areas, expressiveness of the language tools for constructing new types. Typically, low-level programming languages provide a very limited set of built-in types directly implemented by low-level constructs. In contrast, high-level languages usually provide a large set of built-in types, as this can improve their performance.
Most programming languages do not allow changing the operation of built-in types, however, for example, in Smalltalk or Ruby you can not only add new operations to these types, but also change old ones.
Examples of primitive types in various languages
Almost all programming languages include:
- Character type .
- A whole type of different value ranges.
- Link (or similar types of " pointer " in functionality).
- Floating point numbers of varying precision.
Also often included:
- Fixed point numbers .
- Boolean type , meaning true or false .
- String type (sequence of characters).
More exotic primitive types:
- Tuple in ML .
- Line List in Lisp , Scala .
- Complex number in Fortran , C (C99) , Python .
- The rational number in Lisp .
- Closing , continued in functional programming languages such as Lisp and ML .
See also
- Simple type