FazBrowse Wikipedia Viewer | Main Page |
Search Wikipedia:
|
Viewing: https://en.wikipedia.org/wiki/Native_data_type

Data type

Contents
    Enumerations
    String and text types
    Union types
    Pointers and references
    Quantified types

The standard type hierarchy of Python 3

In computer science and computer programming, a data type (or simply type) is a collection or grouping of data values, usually specified by a set of possible values, a set of allowed operations on these values, and/or a representation of these values as machine types. A data type specification in a program constrains the possible values that an expression, such as a variable or a function call, might take. On literal data, it tells the compiler or interpreter how the programmer intends to use the data. Most programming languages support basic data types of integer numbers (of varying sizes), floating-point numbers (which approximate real numbers), characters and Booleans.

b are integers), but displayed in familiar decimal form.

Fixed-point data types are convenient for representing monetary values. They are often implemented internally as integers, leading to predefined limits.

For independence from architecture details, a Bignum or arbitrary precision numeric type might be supplied. This represents an integer or rational to a precision limited only by the available memory and computational resources on the system. Bignum implementations of arithmetic operations on machine-sized values are significantly slower than the corresponding machine operations.

Enumerations

edit

The enumerated type has distinct values, which can be compared and assigned, but which do not necessarily have any particular concrete representation in the computer's memory; compilers and interpreters can represent them arbitrarily. For example, the four suits in a deck of playing cards may be four enumerators named CLUB, DIAMOND, HEART, SPADE, belonging to an enumerated type named suit. If a variable V is declared having suit as its data type, one can assign any of those four values to it. Some implementations allow programmers to assign integer values to the enumeration values, or even treat them as type-equivalent to integers.

String and text types

edit

Strings are a sequence of characters used to store words or plain text, most often textual markup languages representing formatted text. Characters may be a letter of some alphabet, a digit, a blank space, a punctuation mark, etc. Characters are drawn from a character set such as ASCII or Unicode. Character and string types can have different subtypes according to the character encoding. The original 7-bit wide ASCII was found to be limited, and superseded by 8, 16 and 32-bit sets, which can encode a wide variety of non-Latin alphabets (such as Hebrew and Chinese) and other symbols. Strings may be of either variable length or fixed length, and some programming languages have both types. They may also be subtyped by their maximum size.

Since most character sets include the digits, it is possible to have a numeric string, such as "1234". These numeric strings are usually considered distinct from numeric values such as 1234, although some languages automatically convert between them.

Union types

edit
dataLista=Nil|Consa(Lista), and
  • the binary tree, which allows fast searching, and can be defined in Haskell as the ADT

    An abstract data type is a data type that does not specify the concrete representation of the data. Instead, a formal specification based on the data type's operations is used to describe it. Any implementation of a specification must fulfill the rules given. For example, a stack has push/pop operations that follow a Last-In-First-Out rule, and can be concretely implemented using either a list or an array. Abstract data types are used in formal semantics and program verification and, less strictly, in design.

    Pointers and references

    edit

    A type constructor builds new types from old ones, and can be thought of as an operator taking zero or more types as arguments and producing a type. Product types, function types, power types and list types can be made into type constructors.

    Quantified types

    edit

    Universally-quantified and existentially-quantified types are based on predicate logic. Universal quantification is written as

    An intersection type is a type containing those values that are members of two specified types. For example, in Java the class Comparable interfaces. Therefore, an object of type σ∩τ is the set-theoretic intersection of (x:σ)∩τ, where the type

    1. ↑ Parnas, Shore & Weiss 1976.
    2. ↑ type at the Free On-line Dictionary of Computing
    3. ↑ Shaffer, C. A. (2011). Data Structures & Algorithm Analysis in C++ (3rd ed.). Mineola, NY: Dover. 1.2. ISBN 978-0-486-48582-9.
    4. ↑ Dale, Nell B.; Weems, Chip; Headington, Mark R. (1998). Programming in C++. Jones & Bartlett Learning. p. 349. ISBN 978-0-7637-0537-4.
    5. ↑ ISO/IEC 11404, 6.4
    6. ↑ "Integer benchmarks — mp++ 0.27 documentation". bluescarni.github.io.
    7. ↑ Flanagan, David (1997). "6.2 Functions as Data Types". JavaScript: the definitive guide (2nd ed.). Cambridge: O'Reilly & Associates. ISBN 978-1-56592-234-1.
    8. ↑ "Introduction to data types and field properties". support.microsoft.com. Retrieved 28 January 2022.
    9. ↑ Cardelli, Luca; Wegner, Peter (December 1985). "On Understanding Types, Data Abstraction, and Polymorphism" (PDF). ACM Computing Surveys. 17 (4): 471–523. doi:10.1145/6041.6042. ISSN 0360-0300. S2CID 2921816. Archived (PDF) from the original on 2008-12-03.
    10. Czech Republic
    11. Latvia
    12. Israel
  • Other

    View original on Wikipedia | Back | FazBrowse Home