公開
Translation status: 繁體中文 reader-locale proof. Term names and code fences follow the zh-Hant pack; supporting prose may still be English.
Marks an import as re-exported from the current module.
Aliases: public
Syntax: 匯入 取自 <source> 公開 <name>
Category#
modifier
Related#
Examples#
radix/corpus/publica/publica.fab (canonical · keyword)#
Marks an import as re-exported from the current module.
# =============================================================================
# 公開 — Marks an import as re-exported from the current module.
# =============================================================================
#
# What this teaches:
# • Module export visibility — `@ 公開` (en spelling `@ public`) exports a
# declaration from the current module, making it importable by any consumer
# • The opposite of `@ 私有`; controls the public API surface of a module
# • Unmarked top-level declarations are module-private: only `@ 公開` /
# `@ 內部` declarations appear in the file's importable surface
#
# Common mistakes:
# • Leaving a declaration unmarked and expecting it to be importable — the
# export surface is `@ 公開` / `@ 內部` only.
#
# See also: 私有, 匯入
# =============================================================================
# @ 公開 marks a declaration as public metadata
#
# Annotations attach visibility metadata to the following declaration.
#
# GRAMMAR:
# annotatedDecl :← '@' '公開' funcDecl
#
# EXPECTED OUTPUT:
# 公開
@ public { }
fn publicum() → string {
return "publica"
}
main {
print publicum()
}Expected output:
publica