不變
Translation status: 繁體中文 reader-locale proof. Term names and code fences follow the zh-Hant pack; supporting prose may still be English.
Marks a function as non-mutating.
Syntax: 函式 <name>(...) 不變 → <type>
Category#
function
Related#
Examples#
radix/corpus/immutata/immutata.fab (canonical · keyword)#
Marks a function as non-mutating.
# =============================================================================
# 不變 — Marks a function as non-mutating
# =============================================================================
#
# What this teaches:
# • Marks a function as non-mutating.
# • Related keywords: 可拋
#
# Common mistakes:
# • Mutating state inside an `不變` function — `不變` is a non-mutation contract; modifying `傳入` parameters or external state breaks the contract.
#
# See also: 可拋
# =============================================================================
# 不變 — immutability contract on 函式
#
# GRAMMAR:
# funcModifier :← '不變'
#
# EXPECTED OUTPUT:
# No 入口 — declaration or test-runner surface only.
#
# BACKEND:
# declaration-only function modifier (whitelist: 不變/immutata.fab).
#
fn inspecta() readonly → int {
return 0
}