Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
-
public-const-declaration = ("Global" / "Public") module-const-declaration private-const-declaration = ["Private"] module-const-declaration module-const-declaration = const-declaration const-declaration = "Const" const-item-list const-item-list = const-item *[ "," const-item] const-item = typed-name-const-item / untyped-name-const-item typed-name-const-item = TYPED-NAME "=" constant-expression untyped-name-const-item = IDENTIFIER [const-as-clause] "=" constant-expression const-as-clause = "as" BUILTIN-TYPE
-
Static Semantics
The <BUILTIN-TYPE> element of an <const-as-clause> might not be "object" or "[object]".
Each constant defined within a <module-const-declaration> contained within the same module MUST have a different name.
Each constant defined within a <module-const-declaration> MUST have a constant name that is different from any other module variable name, module constant name, enum member name, or procedure name that is defined within the same module.
A constant declaration that is part of a <public-const-declaration> declares a public constant. The constant is accessible within the enclosing project. If the enclosing module is a procedural module that is not a private module, then the constant is also accessible within projects that reference the enclosing project.
A constant declaration that is part of a <private-const-declaration> declares a private constant. The constant is accessible within the enclosing module.
If a constant defined by a <public-const-declaration> has a constant name that is the same as the name of a project or name of a module then all references to the variable name MUST be module qualified unless they occur within the module that contains the <public-const-declaration>
A constant defined by a <module-const-declaration> can have a constant name that is the same as the enum name of a <enum-declaration> defined in the same module but such a constant cannot be referenced using its constant name even if the constant name is module qualified.
If a constant defined by a <public-const-declaration> has a constant name that is the same as the enum name of a public <enum-declaration> in a different module, all references to the constant name MUST be module qualified unless they occur within the module that contains the <public-const-declaration>.
A <typed-name-const-item> defines a constant whose name is the name value of its <TYPED-NAME> element and whose declared type is the declared type corresponding to the <type-suffix> of the <TYPED-NAME> as specified in section 3.3.5.3.
A <untyped-name-const-item> defines a constant whose name is the name value of its <IDENTIFIER> element.
If an <untyped-name-const-item> does not include a <const-as-clause>, the declared type of the constant is the same as the declared type of its <constant-expression> element. Otherwise, the constant’s declared type is the declared type of the <BUILTIN-TYPE> element of the <const-as-clause>.
Any <constant-expression> used within a <const-item> might not reference functions, even the intrinsic functions normally permitted within a <constant-expression>.
The data value of the <constant-expression> element in a <const-item> MUST be let-coercible to the declared type of the constant defined by that <const-item>
The constant binding of a constant defined by a <const-item> is the data value of the <constant-expression> Let-coerced to the declared type of the constant.