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
Related#
Examples#
radix/corpus/reference/keyword/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" text
print "importa-braced"Expected output:
importa-braced
radix/corpus/reference/keyword/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!
radix/corpus/reference/reject/importa/braced-field-english-reject-la.fab (supporting · reject)#
The English record field word from in a la file is an unknown import field (expect parse error).
# =============================================================================
# import — English record field word in a la file (expect parse error)
# =============================================================================
#
# What this teaches:
# • Locale surfaces are sealed in both directions — the la spelling of the
# source field is `from`, so the English `from` is not a field of a la record
# • Parse error — `PARSE050:unknown_import_field` lists the la field words
#
# Common mistakes:
# • writing `from`, `visibility`, `name`, `as` or `all` in a la record —
# write `from`, `visibility`, `name`, `as` or `all`
#
# See also: import, from
# =============================================================================
# English record field word in a la file (expect parse error)
#
# DELIBERATE: this exemplum keeps the English field word (`from`) on purpose, to
# pin the PARSE050 `unknown_import_field` diagnostic in a la file.
import { from = "norma:text" }
print "unreachable"Expected: compilation rejects this example.
radix/corpus/reference/reject/importa/braced-field-latin-reject.fab (supporting · reject)#
The Latin record field word from in an en file is a wrong-locale error (expect parse error).
# =============================================================================
# import — Latin record field word in an en file (expect parse error)
# =============================================================================
#
# What this teaches:
# • Locale surfaces are sealed — the en spelling of the source field is
# `from`, so the Latin `ex` is refused in an en file
# • Parse error — `PARSE050:wrong_locale_import_field` names the word written
# and the en word to use instead
#
# Common mistakes:
# • writing `from`, `visibility`, `name`, `as` or `all` in an en record —
# write `from`, `visibility`, `name`, `as` or `all`
#
# See also: import, from
# =============================================================================
# Latin record field word in an en file (expect parse error)
#
# DELIBERATE: this exemplum keeps the Latin field word (`from`) on purpose, to pin
# the PARSE050 `wrong_locale_import_field` diagnostic.
import { from = "norma:text" }
print "unreachable"Expected: compilation rejects this example.
radix/corpus/reference/reject/importa/import-unknown-norma-module-reject.fab (supporting · reject)#
Importing a norma:* module name that the embedded library does not provide is a package-graph reject.
# This exemplum intentionally fails to compile: `norma:nonexistent` names no
# module of the embedded Norma library, so package analysis rejects the import.
import from "norma:nonexistent" nonexistent
main {
print "unreachable"
}Expected: compilation rejects this example.