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

นำเข้า

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

Imports names from another module or package source.

Aliases: import

Syntax: นำเข้า ออก <source> [สาธารณะ] (<name> [ในชื่อ <alias>] | * ในชื่อ <alias>)

Category#

package

Examples#

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

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

# =============================================================================
# นำเข้า — 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: ออก, ส่วนตัว, annotation-sugar
#
# Common mistakes:
#   • Letting the compiler infer an import name that collides with an existing top-level binding — use `ชื่อ` or `ในชื่อ` to disambiguate (SEM005).
#
# See also: ออก, ส่วนตัว, annotation-sugar
# =============================================================================

# นำเข้า — canonical braced record
#
# The canonical record spells the source field and lets visibility/name defaults
# materialize the same ImportDecl as `นำเข้า ออก "norma:text"`.

import { ออก = "norma:text" }

print "importa-braced"

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

Imports names from another module or package source.

# =============================================================================
# นำเข้า — Imports names from another module or package source
# =============================================================================
#
# What this teaches:
#   • Imports names from another module or package source.
#   • Related keywords: ออก, สาธารณะ, ในชื่อ
#
# Common mistakes:
#   • Missing the `ออก` source in the import record — an import record requires an `ออก` source path.
#
# See also: ออก, สาธารณะ, ในชื่อ
# =============================================================================

# นำเข้า ออก — named import from a sibling module
#
# นำเข้า ออก relative path; an absent marker does not re-export.
#
# GRAMMAR:
#   นำเข้า ออก "<path>" <name> [ในชื่อ <alias>]
#   นำเข้า ออก "<path>" สาธารณะ <name>   (re-export)
#
# Requires module layout: นำเข้า/importa.fab imports from นำเข้า/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!