Program ControlTopExpressionsNamespaces and Bindings

Namespaces and Bindings

GOO is a lexically scoped language. Bindings contain values and are looked up by name. Lexical bindings are visible from only particular textual ranges in a program. Lexical bindings shadow visible bindings of the same name.

At the topmost level, GOO provides simple modules that map from names to bindings. Each file introduces a new module with the same name as the file. Nested modules are supported by way of slashes in module names. Modules can import bindings exported by other modules, but currently there is no way to selectively exclude or rename imported bindings. Furthermore, no cycles can occur in the module use heterarchy.
 DV (DV ,var ,form) S
defines a global variable named (var-name ,var) with an initial value ,form (cf. Scheme's DEFINE).
 DEF (DEF ,var ,val) S
locally binds ,var to ,val and evaluates remainder of current body in the context of that binding.
(DEF (TUP ,var ...) ,val) S
parallel binding can also be specified using TUP on the lhs of a DEF binding. For example (DEF (TUP x y) (TUP 1 2))
 LET (LET ((,var ,val) ...) ,@body) S
== (SEQ (DEF ,var ,val) ... ,@body)

where
 ,var == ,name | (,name ,type) L
with ,name | ,type == (,name ,type) within lists.
 SET (SET ,name ,form) S
sets ,name binding to value of evaluating ,form (cf. Scheme's SET!)
(SET (,name ,@args) ,form) S
== (,name ## -setter ,form ,@args)
 USE (USE ,name) S
loads the module ,name (if it hasn't been loaded already) and aliases all the exported bindings into the current namespace.
 EXPORT (EXPORT ,name) S
makes the binding ,name available to code which uses this module in the future.
 USE/EXPORT (USE/EXPORT ,name) S
same as USE plus reexports all imported bindings.


Program ControlTopExpressionsNamespaces and Bindings