Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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_exp brings names bound in mod_exp into the current scope. These names will also be visible to users of the module.

  • local dec has the meaning of dec, but any names bound by dec will not be visible outside the module.

  • import "foo" is a shorthand for local open import "foo", where the import is interpreted as a module expression (see Modules).

  • #[attr] dec adds an attribute to a declaration (see Attributes).