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