Variable and Module Scope

When a module uses a member, whether it is a module or a variable, it must know where it gets that member. This is called “scope”. To understand scope, a few terms must be thoroughly understood. These are: "child", "parent", "ancestor", and "descendant".

Child

A child of a module is a "member" module of that module (the terms "member module" and "child module" may be used interchangeably).

Parent

A parent is the opposite of a child; in other words, a parent module is a higher module than a child module. A parent module can have many "member" or "child" modules.

Descendant

A descendant is a child, or any child of a descendant (note that this is recursive).

Ancestor

An ancestor is a parent, or an ancestor of a parent (the opposite of a descendant). The root module is an ancestor of every module and every module is a descendant of the root module.

Topics in this section:

Inheritance

Scope Resolution Operator