Record (computer science)

Record (computer science)

"This article is about the data structure and the type."

In computer science, a record type is a type whose values are records, i.e. aggregates of several items of possibly different types. The items being aggregated are called "fields" (or "members") and are usually identified or indexed by "field labels", names identifying the fields.

Record types are mathematically equivalent to product types but they usually behave differently with respect to typing: in most, if not all, typed programming languages, record types are bound to names and two record types are equal for the type system if and only if they have the same name. This contrasts with product types where the equality is the equality of each of the type components individually.

Record types in programming languages

COBOL was the first programming language to support records directly. Algol got it from COBOL, and Pascal got it, more or less indirectly, from Algol; both of them had a notion of record type. C uses the terms struct or structure for both a record and its type. Records and record types are also present in functional programming languages.

Objects, in object-oriented languages, are an example of record and record types correspond to pure virtual classes (even if in practice, partially instantiated classes are used with the same functionality as record types provide). Note that in object-oriented design, record types relate to object composition.

The notion of signature in modular functional programming is another form of record type. If one leaves away the question of subtyping, a "module implementation" corresponds to a record of type a signature.

Representation in memory

The representation of records in memory varies depending on the programming languages, ranging from the juxtaposition of the components in a consecutive block of memory to an array of pointers pointing to the components.

The evolution of the implementation of records reveals the evolution of the concept, starting from the initial use as a collection of data of fixed complexity to the more general notion of a collection of data of any arbitrary complexity, including functions.

See also

* Union


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • computer science — computer scientist. the science that deals with the theory and methods of processing information in digital computers, the design of computer hardware and software, and the applications of computers. [1970 75] * * * Study of computers, their… …   Universalium

  • Reference (computer science) — This article is about a general notion of reference in computing. For the more specific notion of reference used in C++, see Reference (C++). In computer science, a reference is a value that enables a program to indirectly access a particular… …   Wikipedia

  • Lock (computer science) — In computer science, a lock is a synchronization mechanism for enforcing limits on access to a resource in an environment where there are many threads of execution. Locks are one way of enforcing concurrency control policies. Contents 1 Types 2… …   Wikipedia

  • Object (computer science) — In computer science, an object is any entity that can be manipulated by the commands of a programming language, such as a value, variable, function, or data structure. (With the later introduction of object oriented programming the same word,… …   Wikipedia

  • String (computer science) — In formal languages, which are used in mathematical logic and theoretical computer science, a string is a finite sequence of symbols that are chosen from a set or alphabet. In computer programming, a string is traditionally a sequence of… …   Wikipedia

  • Coupling (computer science) — In computer science, coupling or dependency is the degree to which each program module relies on each one of the other modules.Coupling is usually contrasted with cohesion. Low coupling often correlates with high cohesion, and vice versa. The… …   Wikipedia

  • Scope (computer science) — In computer programming, scope is an enclosing context where values and expressions are associated. Various programming languages have various types of scopes. The type of scope determines what kind of entities it can contain and how it affects… …   Wikipedia

  • Polymorphism (computer science) — This article is about the programming language theory concepts with direct application to functional programming languages. For a gentler introduction of these notions as commonly implemented in object oriented programming, see Polymorphism in… …   Wikipedia

  • Integer (computer science) — In computer science, an integer is a datum of integral data type, a data type which represents some finite subset of the mathematical integers. Integral data types may be of different sizes and may or may not be allowed to contain negative values …   Wikipedia

  • Macro (computer science) — A macro (from the Greek μάκρο for long or far) in computer science is a rule or pattern that specifies how a certain input sequence (often a sequence of characters) should be mapped to an output sequence (also often a sequence of characters)… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”