Declarations
Grammar
dec ::= val_bind | type_bind | mod_bind | mod_type_bind
| "open" mod_exp
| "import" stringlit
| "local" dec
| "#[" attr "]" dec
Description
A Wyn module consists of a sequence of declarations. Files are also modules. Each declaration is processed in order, and a declaration can only refer to names bound by preceding declarations.
Any names defined by a declaration inside a module are by default visible to users of that module (see Modules).
Declaration Types
-
open mod_expbrings names bound inmod_expinto the current scope. These names will also be visible to users of the module. -
local dechas the meaning ofdec, but any names bound bydecwill not be visible outside the module. -
import "foo"is a shorthand forlocal open import "foo", where the import is interpreted as a module expression (see Modules). -
#[attr] decadds an attribute to a declaration (see Attributes).