Kết xuấtvi

nhập

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

Imports names from another module or package source.

Aliases: import

Syntax: nhập từ <source> [công_khai] (<name> [như <alias>] | * như <alias>)

Category#

package

Examples#

radix/corpus/importa/default-braced.fab (canonical · keyword)#

Canonical braced import record with private binding inferred from the path.

# =============================================================================
# nhập — Canonical braced import record with private binding inferred from the path
# =============================================================================
#
# What this teaches:
#   • Canonical braced import record with private binding inferred from the path.
#   • Related keywords: từ, riêng_tư, annotation-sugar
#
# Common mistakes:
#   • Letting the compiler infer an import name that collides with an existing top-level binding — use `tên` or `như` to disambiguate (SEM005).
#
# See also: từ, riêng_tư, annotation-sugar
# =============================================================================

# nhập — canonical braced record
#
# The canonical record spells the source field and lets visibility/name defaults
# materialize the same ImportDecl as `nhập từ "norma:text"`.

import { từ = "norma:text" }

print "importa-braced"

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

Imports names from another module or package source.

# =============================================================================
# nhập — Imports names from another module or package source
# =============================================================================
#
# What this teaches:
#   • Imports names from another module or package source.
#   • Related keywords: từ, công_khai, như
#
# Common mistakes:
#   • Missing the `từ` source in the import record — an import record requires an `từ` source path.
#
# See also: từ, công_khai, như
# =============================================================================

# nhập từ — named import from a sibling module
#
# nhập từ relative path; an absent marker does not re-export.
#
# GRAMMAR:
#   nhập từ "<path>" <name> [như <alias>]
#   nhập từ "<path>" công_khai <name>   (re-export)
#
# Requires module layout: nhập/importa.fab imports from nhập/auxilium.fab.
# Harness compiles single files in isolation — sibling resolution needs package
# or module mode (faber check --package), not bare single-file emit.
#
# EXPECTED OUTPUT:
#   "Salve, Marcus!" on successful link.
#
# BACKEND: Rust/Go e2e whitelist — single-file compile cannot resolve sibling.

import from "./auxilium" auxilium

main {
    print auxilium.saluta("Marcus")
}

Expected output:

Salve, Marcus!