LOTUSSCRIPT LANGUAGE
LotusScript recognizes three kinds of scope:
Two variables or procedures with the same name cannot be declared in the same scope. The result is a name conflict. The compiler reports an error when it encounters a name conflict in a script.
Variables or procedures declared in different scopes can have the same name. LotusScript interprets the name as referring to the variable or procedure declared in the innermost scope that is visible where the reference is used.
A variable or procedure of the same name declared at a scope outside of this innermost visible scope is not accessible. This effect is called shadowing: the outer declaration(s) of the name are shadowed, or made invisible, by the inner declaration.
Module scope
A variable is declared in module scope if the declaration is outside of any procedure, class, or type definition in the module. The variable name has a meaning as long as the module is loaded.
The variable name is visible anywhere within the module and has the meaning specified in the declaration, except within a procedure, type, or class where the same variable name is also declared.
The variable is Private by default and can be referred to only within the module that defines it. A variable can be referred to in other modules only if it is declared as Public and the other modules access the defining module with the Use statement.
The following situations result in a name conflict across modules:
A variable is declared in procedure scope if it is declared within the definition of a function, a sub, or a property. Only inside the procedure does the variable name have the meaning specified in the declaration. The variable name is visible anywhere within the procedure.
Ordinarily, the variable is created and initialized when the procedure is invoked, and deleted when the procedure exits. This behavior can be modified with the Static keyword:
A variable is declared in type or class scope if it is declared within the definition of a type or a class (for classes, it must additionally be declared outside the definition of a procedure). The variable is called a member variable of the type or class.
The visibility of a type member variable is automatically Public.
Each class member variable can be declared Public or Private. A Private member can only be referred to within the class or its derived classes; class member variables are Private by default.