การเรนเดอร์th-TH

สาธารณะ

Translation status: ภาษาไทย reader-locale proof. Term names and code fences follow the th-TH pack; supporting prose may still be English.

Marks an import as re-exported from the current module.

Aliases: public

Syntax: importa ex <source> publica <name>

Category#

modifier

Examples#

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

Marks an import as re-exported from the current module.

# =============================================================================
# publica — Marks an import as re-exported from the current module.
# =============================================================================
#
# What this teaches:
#   • Module export visibility — `@ publica` (en spelling `@ public`) exports a
#     declaration from the current module, making it importable by any consumer
#   • The opposite of `@ privata`; controls the public API surface of a module
#   • Unmarked top-level declarations are module-private: only `@ publica` /
#     `@ interna` declarations appear in the file's importable surface
#
# Common mistakes:
#   • Leaving a declaration unmarked and expecting it to be importable — the
#     export surface is `@ publica` / `@ interna` only.
#
# See also: privata, importa
# =============================================================================

# @ publica marks a declaration as public metadata
#
# Annotations attach visibility metadata to the following declaration.
#
# GRAMMAR:
#   annotatedDecl :← '@' 'publica' funcDecl
#
# EXPECTED OUTPUT:
#   publica

@ public
fn publicum()  string {
    return "publica"
}

main {
    print publicum()
}

Expected output:

publica