Kết xuấtvi

công_khai

Translation status: Tiếng Việt reader-locale proof. Term names and code fences follow the vi pack; supporting prose may still be English.

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

Aliases: public

Syntax: nhập từ <source> công_khai <name>

Category#

modifier

Examples#

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

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

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

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

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

main {
    print publicum()
}

Expected output:

publica