渲染zh-Hant

結構

Translation status: 繁體中文 reader-locale proof. Term names and code fences follow the zh-Hant pack; supporting prose may still be English.

Declares an application-owned relational heading (experimental).

Aliases: relational heading

Syntax: 結構 <Name> { 欄位 <type> <name> ... }

Category#

declaration

Examples#

radix/corpus/schema/schema.fab (canonical · keyword)#

Declares an application-owned relational heading (experimental).

# =============================================================================
# 結構 — Declares an application-owned relational heading (experimental)
# =============================================================================
#
# What this teaches:
#   • Relational headings — `結構 Name { ... }` names the columns an application reads from a database result.
#   • Declaration only — a 結構 carries column metadata, not a runtime value, so a program that declares one still runs unchanged.
#
# Common mistakes:
#   • Giving a 結構 methods or `實作` — a 結構 is a heading, not a 類型; both are rejected at parse time.
#
# See also: 欄位, 類型
# =============================================================================

# 結構 — relational heading declaration
#
# GRAMMAR:
#   schemaDecl :← '結構' IDENTIFIER '{' (schemaColumn (NEWLINE schemaColumn)*)? '}'
#
# EXPECTED OUTPUT:
#   結構 declared

結構 Persona {
    column string 名稱
    column int aetas
}

main {
    print "schema declared"
}

Expected output:

schema declared