渲染zh-Hans

私有

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

Marks a declaration as module-private (the default tier).

Aliases: private

Syntax: @ 私有 <declaration>

Category#

modifier

Examples#

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

Marks a declaration as module-private (the default tier).

# =============================================================================
# 私有 — Marks a declaration as module-private (the default tier).
# =============================================================================
#
# What this teaches:
#   • Module-level visibility — `@ 私有` (en spelling `@ private`) restricts
#     a declaration to the current module, keeping it out of the importable
#     surface
#   • Used as an annotation (`@ 私有`) on function declarations to control
#     the module boundary; unmarked declarations are module-private by default
#
# Common mistakes:
#   • Expecting `@ 私有` to mean anything beyond module-private — it is an
#     explicit marker for the default tier (accepted, no warning).
#
# See also: 公开, 导入
# =============================================================================

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

@ private { }
fn privatum() → string {
    return "privata"
}

main {
    print privatum()
}

Expected output:

privata