Tagged union
In computer science, a tagged union, also called a variant, variant record, choice type, discriminated union, disjoint union, sum type or coproduct, 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 that has several "cases", each of which should be handled correctly when that type is manipulated. This is critical in defining recursive datatypes, in which some component of a value may have the same type as the value itself, for example in defining a type for representing trees, where it is necessary to distinguish multi-node subtrees and leaves. 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 union - Wikipedia Jump to content From Wikipedia, the free encyclopedia Union data structure with enforced cases In computer science , a tagged union , also called a variant , variant record , choice type , discriminated union , disjoint union , sum type , or coproduct , 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 type is in use. It can be thought of as a type that has several "cases", each of which should be handled correctly when that typ
Explore this link on the map →related reading
- A half-hour to learn Rustfasterthanli.me
- Use tagging to enrich your research - TestingTimetestingtime.com
- Defining an Enum - The Rust Programming Languagedoc.rust-lang.org
- Rust Language Cheat Sheetcheats.rs
- Reading 11: Recursive Data Typesweb.mit.edu
- Variance - Rust Compiler Development Guiderustc-dev-guide.rust-lang.org
- Polymorphic Universes - Coq 8.18.0 documentationcoq.inria.fr
- Bartosz Milewski's Programming Cafe | Category Theory, Haskell, Concurrency, C++bartoszmilewski.com
- Reading 19: Little Languagesweb.mit.edu
- Reading 17: Recursive Data Typesweb.mit.edu
- Reading 17: Recursive Data Typesweb.mit.edu
- No, dynamic type systems are not inherently more openlexi-lambda.github.io