Saving Metadata About Types: IDL Files


The need to preserve metadata about types has been known for a number of years , and a variety of component architectures already provide solutions to this problem. COM and CORBA, for example, allow developers to describe their components' interfaces in an IDL. IDL files serve as the public interface to the components they describe. The IDL syntax of both COM and CORBA is based on C/C++. The compilation of IDL files produces binary descriptions of the metadata described by the IDL files. In CORBA, this description is known as an interface repository; in COM, it is known as a type library.

A number of limitations arise with the use of IDL files.

  • IDL files remain separate from the source files of a type, which may lead to inconsistencies. For example, if an IDL file states that a method takes no parameters but the definition of the method asks for a parameter, then the IDL and source files must be synchronized before clients can successfully program against the type's interface.

  • IDL files can be compiled before a type's definition has even appeared, so the binary files produced by the IDL compilers are kept separate from the type's implementation files. Thus a developer might have one file without the other; that is, a developer might have a type library for a type without having the definition of the type available on the system, and vice versa. COM provides one solution to this problem: Type libraries can be embedded in executable files as a resource, which ties the type library to its implementation.

Another approach is to have the language compiler generate the type's metadata directly when compiling the source files, rather than during a separate IDL compilation. In this case, the language compiler can also embed the metadata directly into the implementation file for the type, which is similar to how a type library can be embedded as a resource. This method does not permit a type's metadata to exist with the definition of the type, and vice versa. It also prohibits incompatibility between a type and its metadata description. The CLR uses this technique to manage metadata.



Programming in the .NET Environment
Programming in the .NET Environment
ISBN: 0201770180
EAN: 2147483647
Year: 2002
Pages: 146

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net