Imports
One shape covers every import:
importa ex "<source>" privata <name>Import, from this source, privately, this name. privata and publica
control whether the imported name is re-exported from your module.
From the standard library#
Norma modules are named norma:<module>.
faber format --locale en — English reader surfaceimport from "norma:consolum" private consolum
main {
print "ready"
}faber format --locale la — canonical Faberimporta ex "norma:consolum" privata consolum
incipit {
nota "ready"
}faber format --locale th-TH — Thaiนำเข้า ออก "norma:consolum" ส่วนตัว consolum
เริ่ม {
บันทึก "ready"
}faber format --locale zh-Hans — Simplified Chinese导入 取自 "norma:consolum" 私有 consolum
入口 {
显示 "ready"
}faber format --locale zh-Hant — Traditional Chinese匯入 取自 "norma:consolum" 私有 consolum
入口 {
註記 "ready"
}faber format --locale vi — Vietnamesenhập từ "norma:consolum" riêng_tư consolum
bắt_đầu {
ghi_chú "ready"
}faber format --locale ar — Arabicاستورد من "norma:consolum" خاص consolum
بداية {
اعرض "ready"
}faber format --locale hi — Hindiआयात सेवन "norma:consolum" निजी consolum
आरंभ {
दिखाओ "ready"
}From a local file#
A relative path imports a sibling module. No extension.
faber format --locale en — English reader surfaceimport from "./auxilium" private saluta
main {
print "ready"
}faber format --locale la — canonical Faberimporta ex "./auxilium" privata saluta
incipit {
nota "ready"
}faber format --locale th-TH — Thaiนำเข้า ออก "./auxilium" ส่วนตัว saluta
เริ่ม {
บันทึก "ready"
}faber format --locale zh-Hans — Simplified Chinese导入 取自 "./auxilium" 私有 saluta
入口 {
显示 "ready"
}faber format --locale zh-Hant — Traditional Chinese匯入 取自 "./auxilium" 私有 saluta
入口 {
註記 "ready"
}faber format --locale vi — Vietnamesenhập từ "./auxilium" riêng_tư saluta
bắt_đầu {
ghi_chú "ready"
}faber format --locale ar — Arabicاستورد من "./auxilium" خاص saluta
بداية {
اعرض "ready"
}faber format --locale hi — Hindiआयात सेवन "./auxilium" निजी saluta
आरंभ {
दिखाओ "ready"
}Importing a specific item#
The name after privata is the item, not the module — so you import exactly
what you use.
faber format --locale en — English reader surfaceimport from "norma:textus" private textus
main {
print "ready"
}faber format --locale la — canonical Faberimporta ex "norma:textus" privata textus
incipit {
nota "ready"
}faber format --locale th-TH — Thaiนำเข้า ออก "norma:textus" ส่วนตัว textus
เริ่ม {
บันทึก "ready"
}faber format --locale zh-Hans — Simplified Chinese导入 取自 "norma:textus" 私有 textus
入口 {
显示 "ready"
}faber format --locale zh-Hant — Traditional Chinese匯入 取自 "norma:textus" 私有 textus
入口 {
註記 "ready"
}faber format --locale vi — Vietnamesenhập từ "norma:textus" riêng_tư textus
bắt_đầu {
ghi_chú "ready"
}faber format --locale ar — Arabicاستورد من "norma:textus" خاص textus
بداية {
اعرض "ready"
}faber format --locale hi — Hindiआयात सेवन "norma:textus" निजी textus
आरंभ {
दिखाओ "ready"
}Aliasing#
as renames on the way in.
faber format --locale en — English reader surfaceimport from "./auxilium" private saluta as greet
main {
print "ready"
}faber format --locale la — canonical Faberimporta ex "./auxilium" privata saluta ut greet
incipit {
nota "ready"
}faber format --locale th-TH — Thaiนำเข้า ออก "./auxilium" ส่วนตัว saluta ในชื่อ greet
เริ่ม {
บันทึก "ready"
}faber format --locale zh-Hans — Simplified Chinese导入 取自 "./auxilium" 私有 saluta 作为 greet
入口 {
显示 "ready"
}faber format --locale zh-Hant — Traditional Chinese匯入 取自 "./auxilium" 私有 saluta 作為 greet
入口 {
註記 "ready"
}faber format --locale vi — Vietnamesenhập từ "./auxilium" riêng_tư saluta như greet
bắt_đầu {
ghi_chú "ready"
}faber format --locale ar — Arabicاستورد من "./auxilium" خاص saluta كـ greet
بداية {
اعرض "ready"
}faber format --locale 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#
publica imports and re-exports, so consumers of your module see the name
too.
faber format --locale en — English reader surfaceimport from "norma:textus" public textus
main {
print "ready"
}faber format --locale la — canonical Faberimporta ex "norma:textus" publica textus
incipit {
nota "ready"
}faber format --locale th-TH — Thaiนำเข้า ออก "norma:textus" สาธารณะ textus
เริ่ม {
บันทึก "ready"
}faber format --locale zh-Hans — Simplified Chinese导入 取自 "norma:textus" 公开 textus
入口 {
显示 "ready"
}faber format --locale zh-Hant — Traditional Chinese匯入 取自 "norma:textus" 公開 textus
入口 {
註記 "ready"
}faber format --locale vi — Vietnamesenhập từ "norma:textus" công_khai textus
bắt_đầu {
ghi_chú "ready"
}faber format --locale ar — Arabicاستورد من "norma:textus" عام textus
بداية {
اعرض "ready"
}faber format --locale hi — Hindiआयात सेवन "norma:textus" सार्वजनिक textus
आरंभ {
दिखाओ "ready"
}Use privata unless you deliberately intend to widen your module's surface.
privata is the one you want almost always.
At a glance#
| Form | Effect |
|---|---|
importa ex "norma:consolum" privata consolum | Standard library module |
importa ex "./auxilium" privata saluta | Item from a sibling file |
importa ex "./auxilium" privata saluta ut greet | …bound under a different name |
importa ex "norma:textus" publica textus | Imported and re-exported |
Related: Your first package for how modules sit inside a package · Packages with Cista for dependency resolution