On this page:
export
all_  from
rename
names
all_  defined
#%juxtapose
as
except
meta
meta_  label
only_  space
except_  space
.
/
lib
file
!
self
parent
8.12

6.5 Export🔗ℹ

nestable declaration

export:

  export_clause

  ...

 

nestable declaration

export export_clause

 

export_clause

 = 

export_item

 | 

export_item:

  modifier

  ...

 | 

modifier:

  export_clause

  ...

 

export_item

 = 

id_or_op

 | 

all_from(source)

 | 

rename rename_decl

 | 

names names_decl

 | 

all_defined all_defined_decl

 | 

export_item #%juxtapose export_item

 | 

other_export

 

id_or_op

 = 

id_name

 | 

op_name

 

modifier

 = 

except except_decl

 | 

meta meta_decl

 | 

meta_label

 | 

only_space only_space_decl

 | 

except_space except_space_decl

 | 

other_modifier

Exports from the enclosing module or namespace. An export form with a single immediate export_clause is shorthand for an export form that has a block containing the single export_clause.

An export_item can be an identifier, operator, other export form, such as all_from. It can also be a sequence export_items within a group, since #%juxtapose is defined as an export form.

Similar to import, an export_item can be modified either through a subsequent block containing modifiers or by a preceding modifier with the export_items in a block. The latter order works only if the modifier itself does not need a block.

An id_name or op_name export can be an immediate identifier or oerator, or it can be dotted name, such as List.length. The last component of a dotted name is used as the export name. See Namespaces for information on id_name and op_name.

With module_path, exports all bindings imported without a prefix from module_path, where module_path appears the same via import. “The same” means that the module paths are the same after some normalization: paths that use /-separated indentifiers are converted to lib forms, and in a lib form, an implicit .rhm suffix is made explicit.

With . id_name, exports the content of the specified namespace or module import (i.e., the content that would be accessed with a prefix in the exporting context). See Namespaces for information on id_name.

For each as group, exports int_id_or_op bound locally so that it’s imported as ext_id_or_op.

export

names:

  id_or_op ...

  ...

Exports all id_or_ops.

Most id_or_ops can be exported directly without using names, but the names form disambiguates in the case of an id_or_op that is itself bound as an export form or modifier.

export

all_defined

 

export

all_defined ~scope_like id

Exports all identifiers defined within the enclosing module or namespace that could be referened by a names form using the same scopes as id or (when no id is provided) the all_defined identifier itself. Supplying ~scope_like id is particularly useful in the case of a macro-introduced all_defined form.

Imports using import count as definitions only when the import is from a namespace. Imports from a module do no count as definitions.

Exports the union of bindings described by the two export_items.

The #%juxtapose form is implicitly used when an export is used in after another export in an export position. See also Implicit Forms.

export

as

Invalid by itself, and intended for use with rename.

export modifier

except export_item

 

export modifier

except:

  export_item

  ...

Modifies an export to remove the bindings with the same external names as those that would be exported by the export_items.

export modifier

meta

 

export modifier

meta phase

Modifies exports to apply at phase more than the enclosing context’s phase, where phase defaults to 1.

This modifier is valid only immediately within a modules, and not within namespace forms.

export modifier

meta_label

Modifies exports to apply at the label phase.

This modifier is valid only immediately within a modules, and not within namespace forms.

export modifier

only_space id

 

export modifier

only_space: id ...

 

export modifier

except_space id

 

export modifier

except_space: id ...

Modifies an export clause to include bindings only in the specifically listed spaces or only in the spaces not specifically listed.

export

id_name . id

 

export

id_name . (op)

In an export clause, . can be used only to form a and id_name or op_name as described for export. It can also be used to form an id_name for all_from.

Like the / operator for import module paths, used for module paths in all_from.

module path

lib(string)

Like the lib form for import, used for module paths in all_from.

module path

file(string)

Like the file form for import, used for module paths in all_from.

module path

module_path ! id

Like the ! operator for import to access a submodule, used for module paths in all_from.

module path

self ! id

 

module path

parent

Like the self and parent import forms, used for module paths in all_from.