![]() |
An IDL file forms a naming scope (referred to, in short, as a scope). Modules, interface statements, structures, unions, methods (operations), and exceptions form nested scopes. An identifier can only be defined one time in a particular scope. Identifiers can be redefined in nested scopes.
Names can be used in an unqualified form within a scope, and the name will be resolved by successively searching the enclosing scopes. When an unqualified name is defined in an enclosing scope, that name cannot be redefined.
Fully-qualified names have the following form:
scope-name::identifierFor example, the method name mymethod defined within the interface Test of module M1 has the fully-qualified name:
M1::Test::mymethodA qualified name is resolved by first resolving the scope-name to a particular scope, S, and then locating the definition of the identifier within that scope. Scopes that enclose the scope S are not searched.
Qualified names can also have the following form:
::identifierThese names are resolved by locating the definition of identifier within the outermost name scope.
Every name defined in an IDL specification is given a global name, constructed as follows:
- Before the IDL compiler scans the IDL file, the name of the current root and the name of the current scope are empty. When each module is encountered, the string of two colons (::) and the module name are appended to the name of the current root. At the end of the module, they are removed.
- When each interface, struct, union, or exception definition is encountered, the string of two colons (::) and the associated name are appended to the name of the current scope. At the end of the definition, they are removed. While parameters of an operation declaration are processed, a new unnamed scope is entered so that parameter names can duplicate other identifiers.
- The global name of an IDL definition is then the concatenation of the current root, the current scope, two colons (::), and the local name for the definition.
The names of types, constants, and exceptions defined by base interfaces are accessible in a derived interface. References to these names must be unambiguous. Ambiguities can be resolved by using a scoped name (prefacing the name with the name of the interface that defines it, and the two colons (::), as in base-interface::identifier). Scope names can also be used to refer to a constant, type, or an exception name defined by a base interface but redefined by a derived interface.
Related tasks... | |
Creating IDL files for an Enterprise JavaBean | |
Related concepts... | |
Interface Definition Language (IDL), usage and implementation | |