IDL name scoping

An Interface Definition List (IDL) file, together with the contents of any files referenced by #include statements, forms a naming scope. Definitions that do not appear inside a scope are part of the global scope. The following kinds of definitions introduce nested scopes: module, interface, valuetype, struct, union, operation, and exception. An identifier can be defined one time in a particular scope. Identifiers can be redefined in nested scopes, except that an identifier cannot be the same as the identifier defining the scope. For example, an interface X cannot contain an identifier named X. It is possible to define multiple modules with the same identifier. The first declaration of the module defines the module. Subsequent declarations of the module with the same identifier reopens the module and hence its scope, which allows additional definitions to be added to it.

A particular definition may be referenced using an unqualified name (simply the name of the identifier) or a qualified name. An unqualified name reference is resolved by successively searching the enclosing scopes. If an unqualified name is referenced in a scope, that identifier cannot be redefined within the same scope.

A qualified name reference is a series of identifiers with intervening double colons (::). The last identifier is the name of the definition and the leftmost identifiers indicate the scope of the definition. Qualified names have the following form:

scope-name::identifier 

For example, the method name mymethod defined within the interface Test of module M1 has the fully qualified name:

M1::Test::mymethod 

A 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 also can have the following form:

 ::identifier

These 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 and is constructed as follows:

The names of types, constants, and exceptions defined by base interfaces and valuetypes 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 also can be used to refer to a constant, type, or an exception name defined by a base interface or valuetype but redefined by a derived interface or valuetype.


Related concepts
Interface Definition Language (IDL)



Searchable topic ID:   rcor_idlnsc
Last updated: Jun 21, 2007 8:07:48 PM CDT    WebSphere Business Integration Server Foundation, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.wasee.doc/info/ee/corba/ref/rcor_idlnsc.html

Library | Support | Terms of Use | Feedback