typus
Translation status: 繁體中文 reader-locale proof. Code fences render through the zh-Hant pipeline; prose is canonical Latin.
Declares a type alias.
Aliases: type
Syntax: typus <name> = <type>
Category#
type
Related#
Examples#
radix/corpus/typus/typus.fab (canonical · keyword)#
Declares a type alias.
# =============================================================================
# typus — Declares a type alias.
# =============================================================================
#
# What this teaches:
# • Type aliases — `typus` for creating shorthand names for complex types
# • Generic aliases — aliases can wrap generic types like `lista<T>` and `tabula<K,V>`
#
# Common mistakes:
# • confusing typus (type alias) with genus (nominal type) — typus creates a transparent alias, not a new type
#
# See also: genus, implendum, objectum, ∪
# =============================================================================
# Type aliases
#
# typus Nomen = Typus
#
# GRAMMAR:
# typeAliasDecl :← 'typus' ident '=' typeExpr
#
# EXPECTED OUTPUT:
# 42, "Marcus", verum, ["Gaius", "Lucius", "Titus"], [100, 95, 87]
# --- Primitive type aliases ---
type Signum = int
type Cognomen = string
type Viget = bool
# --- Generic type aliases ---
type Nomina = list<string>
type Puncta = list<int>
type Index = map<string, int>
# Nullable type alias (canonical T ∪ nihil form)
type NomenOptivum = string ∪ null
main {
# Using primitive aliases
const Signum signum ← 42
const Cognomen cognomen ← "Marcus"
const Viget viget ← true
print signum
print cognomen
print viget
# Using generic aliases
const Nomina sodales ← ["Gaius", "Lucius", "Titus"]
print sodales
const Puncta puncta ← [100, 95, 87]
print puncta
}