Renderingen-US

import

Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.

Imports names from another module or package source.

Aliases: import

Syntax: import from <source> [public] (<name> [as <alias>] | * as <alias>)

Category#

package

Examples#

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

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

# =============================================================================
# import — 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: from, private, annotation-sugar
#
# Common mistakes:
#   • Letting the compiler infer an import name that collides with an existing top-level binding — use `name` or `as` to disambiguate (SEM005).
#
# See also: from, private, annotation-sugar
# =============================================================================

# import — canonical braced record
#
# The canonical record spells the source field and lets visibility/name defaults
# materialize the same ImportDecl as `import from "norma:text"`.

import { from = "norma:text" }

print "importa-braced"

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

Imports names from another module or package source.

# =============================================================================
# import — Imports names from another module or package source
# =============================================================================
#
# What this teaches:
#   • Imports names from another module or package source.
#   • Related keywords: from, public, as
#
# Common mistakes:
#   • Missing the `from` source in the import record — an import record requires an `from` source path.
#
# See also: from, public, as
# =============================================================================

# import from — named import from a sibling module
#
# import from relative path; an absent marker does not re-export.
#
# GRAMMAR:
#   import from "<path>" <name> [as <alias>]
#   import from "<path>" public <name>   (re-export)
#
# Requires module layout: import/importa.fab imports from import/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!