Records
A record is an abstract data type containing a series of named fields. It has no associated behaviour and acts as a way to group data together. In C++, this would be referred to as a plain old data (opens in a new tab) type.
Depending on the language, records may be expressed in in different ways.
Language | Equivalent Construct |
---|---|
Rust | Struct |
C | Struct |
Python | Data Class (opens in a new tab) |
TypeScript | Type alias (opens in a new tab) |
Syntax
A record contains a list of fields, where each field must be given a type.
record person {
name: string,
age: u32,
has-lego-action-figure: bool,
}
For a more details, consult the Item: record
section (opens in a new tab) in the
*.wai
format.