Require Statement

Gives a module access to a library module, and lets you use its public names directly.

Syntax

Usual construct

Require library_name [ As short_name ] [ , library_name ]…

Limits construct

Require library_name [ As short_name ] Where limit [ { And | Or } limit ]…

Parts

library_name
Mandatory qualified name for a library. The usual construct permits a list with commas between each. But the limits construct can have only one.
short_name
Optional alternative name that you give for a library.
limit

Mandatory in the limits construct, a comparison expression. You can use one or more limits to find the correct library if different libraries have the same name.

Limit

attrib_name comparison_op attrib_value
attrib_name
Mandatory name.
comparison_op
One of the comparison operators: =, <, <=, >, >=, or <>.
attrib_value
Mandatory literal of DateTime, string, or version number.

Instructions

TODO

Usual construct

TODO

Limits construct

You use the limits construct when more than one library with the same name is available. You can compare the names and values supplied by the statements Where in each library. These values can have one of three data types: DateTime, String, or version number.

Comparing strings

You can compare a string identifier to a string literal. The only comparison operators permitted are equality (=) and inequality (<>). To be equal, the letter case used by Require must be the same used by the library. An example follows.

Require MyLibrary Where author = "John Doe"

Comparing versions

You can compare a version identifier to a version literal. All comparison operators are available: =, <, <=, >, >=, and <>. An example follows.

Require MyLibrary Where version = 1.5.0

You can also compare a version identifier to a range of versions. You must write this in the sequence (1) lower version, (2) comparison, (3) identifier, (4) comparison, (5) higher version. The comparisons must be one of the operators < or <=. An example follows.

Require MyLibrary Where 1.1.0 <= version < 2.0.0

And and Or

You can put two or more comparisons together with one of the operators And and Or. These operators operate the same as the logical operators with the same name.

If you put the operator And between comparisons, then the two must be true. But if you put the operator Or between comparisons, then only one must be true.

The logical operators usually evaluate in sequence from left to right. But you can change this with parentheses (“( )”). Comparisons between parentheses evaluate before outer comparisons. An example follows.

Require MyLibrary _
    Where (author = "John Doe" And version < 2.1.0) _
    Or (author = "Jane Doe" And version >= 2.1.0)

Version literal

number . number . number [ . number ]
number
One of three or four groups of decimal integers. The compiler ignores zeroes before other numbers at the start of a group.
For example, «1.02.03» is the same as «1.2.3».

Examples

Require ViviFire.IO
Require MyProject.TestHarness Where version = 2.1.0

See also