kiểu_tên
Translation status: Tiếng Việt reader-locale proof. Term names and code fences follow the vi pack; supporting prose may still be English.
Declares a type alias.
Aliases: type
Syntax: kiểu_tên <name> = <type>
Category#
type
Related#
Examples#
radix/corpus/typus/typus.fab (canonical · keyword)#
Declares a type alias.
# =============================================================================
# kiểu_tên — Declares a type alias.
# =============================================================================
#
# What this teaches:
# • Type aliases — `kiểu_tên` for creating shorthand names for complex types
# • Generic aliases — aliases can wrap generic types like `danh_sách<T>` and `bảng<K,V>`
#
# Common mistakes:
# • confusing kiểu_tên (type alias) with kiểu (nominal type) — kiểu_tên creates a transparent alias, not a new type
#
# See also: kiểu, giao_ước, đối_tượng, ∪
# =============================================================================
# Type aliases
#
# kiểu_tên Nomen = Typus
#
# GRAMMAR:
# typeAliasDecl :← 'kiểu_tên' ident '=' typeExpr
#
# EXPECTED OUTPUT:
# 42, "Marcus", đúng, ["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 ∪ rỗng_ty form)
type NomenOptivum = string ∪ none
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
}