Renderingen-US

Imports

The common sugar form is:

import from "<source>" <name>

Import this name from this source. Imports do not re-export by default; use public when the imported name should be visible to consumers of your module. The retired private import marker is not valid.

From the standard library#

Norma modules are named norma:<module>.

reader locale
faber convert --to en — English reader surface
import from "norma:consolum" consolum

main {
    print "ready"
}
faber convert --to la — canonical Faber
importa ex "norma:consolum" consolum

incipit {
    nota "ready"
}
faber convert --to th-TH — Thai
นำเข้า ออก "norma:consolum" consolum

เริ่ม {
    บันทึก "ready"
}
faber convert --to zh-Hans — Simplified Chinese
导入 取自 "norma:consolum" consolum

入口 {
    显示 "ready"
}
faber convert --to zh-Hant — Traditional Chinese
匯入 取自 "norma:consolum" consolum

入口 {
    註記 "ready"
}
faber convert --to vi — Vietnamese
nhập từ "norma:consolum" consolum

bắt_đầu {
    ghi_chú "ready"
}
faber convert --to ar — Arabic
استورد من "norma:consolum" consolum

بداية {
    اعرض "ready"
}
faber convert --to hi — Hindi
आयात सेवन "norma:consolum" consolum

आरंभ {
    दिखाओ "ready"
}

From a local file#

A relative path imports a sibling module. No extension.

reader locale
faber convert --to en — English reader surface
import from "./auxilium" saluta

main {
    print "ready"
}
faber convert --to la — canonical Faber
importa ex "./auxilium" saluta

incipit {
    nota "ready"
}
faber convert --to th-TH — Thai
นำเข้า ออก "./auxilium" saluta

เริ่ม {
    บันทึก "ready"
}
faber convert --to zh-Hans — Simplified Chinese
导入 取自 "./auxilium" saluta

入口 {
    显示 "ready"
}
faber convert --to zh-Hant — Traditional Chinese
匯入 取自 "./auxilium" saluta

入口 {
    註記 "ready"
}
faber convert --to vi — Vietnamese
nhập từ "./auxilium" saluta

bắt_đầu {
    ghi_chú "ready"
}
faber convert --to ar — Arabic
استورد من "./auxilium" saluta

بداية {
    اعرض "ready"
}
faber convert --to hi — Hindi
आयात सेवन "./auxilium" saluta

आरंभ {
    दिखाओ "ready"
}

Importing a specific item#

The name after the source is the item, not the module — so you import exactly what you use.

import from "norma:textus" string

main {
    print "ready"
}

Aliasing#

as renames on the way in.

reader locale
faber convert --to en — English reader surface
import from "./auxilium" saluta as greet

main {
    print "ready"
}
faber convert --to la — canonical Faber
importa ex "./auxilium" saluta ut greet

incipit {
    nota "ready"
}
faber convert --to th-TH — Thai
นำเข้า ออก "./auxilium" saluta ในชื่อ greet

เริ่ม {
    บันทึก "ready"
}
faber convert --to zh-Hans — Simplified Chinese
导入 取自 "./auxilium" saluta 作为 greet

入口 {
    显示 "ready"
}
faber convert --to zh-Hant — Traditional Chinese
匯入 取自 "./auxilium" saluta 作為 greet

入口 {
    註記 "ready"
}
faber convert --to vi — Vietnamese
nhập từ "./auxilium" saluta như greet

bắt_đầu {
    ghi_chú "ready"
}
faber convert --to ar — Arabic
استورد من "./auxilium" saluta كـ greet

بداية {
    اعرض "ready"
}
faber convert --to hi — Hindi
आयात सेवन "./auxilium" saluta रूपमें greet

आरंभ {
    दिखाओ "ready"
}

Useful when two modules export the same name, or when the original reads badly at the call site.

Re-exporting#

public imports and re-exports, so consumers of your module see the name too. Imports without it remain private to the current module.

import from "norma:textus" public string

main {
    print "ready"
}

Use public only when you deliberately intend to widen your module's surface.

At a glance#

FormEffect
import from "norma:consolum" consolumStandard library module
import from "./auxilium" salutaItem from a sibling file
import from "./auxilium" saluta as greet…bound under a different name
import from "norma:textus" public stringImported and re-exported

Related: A program is a package for how modules let inside a package · Packages with Cista for dependency resolution