Издательство: | Книга по требованию |
Дата выхода: | июль 2011 |
ISBN: | 978-6-1305-0746-6 |
Объём: | 100 страниц |
Масса: | 172 г |
Размеры(В x Ш x Т), см: | 23 x 16 x 1 |
High Quality Content by WIKIPEDIA articles! In computer science, a tagged union, also called a variant, variant record, discriminated union, or disjoint union, is a data structure used to hold a value that could take on several different, but fixed types. Only one of the types can be in use at any one time, and a tag field explicitly indicates which one is in use. It can be thought of as a type which has several "cases," each of which should be handled correctly when that type is manipulated. Like ordinary unions, tagged unions can save storage by overlapping storage areas for each type, since only one is in use at a time. Tagged unions are most important in functional languages such as ML and Haskell, where they are called datatypes (see algebraic data type) and the compiler is able to verify that all cases of a tagged union are always handled, avoiding many types of errors. They can, however, be constructed in nearly any language, and are much safer than untagged unions, often simply called unions, which are similar but do not explicitly keep track of which member of the union is currently in use.
Данное издание не является оригинальным. Книга печатается по технологии принт-он-деманд после получения заказа.