The Common Language Implementation (CLIM) subsystem provides a platform-independent interface that is primarily intended to describe the shared behavior of IBM Smalltalk classes. A class in Smalltalk is an abstraction that describes a kind of object. We have already encountered a large number of IBM Smalltalk classes in the previous section on CLDT: Integer, SortedCollection, Date, and so on. One of the fundamental symmetries of the Smalltalk environment is that every object is an instance of a class. That includes classes themselves, which are instances of special classes called metaclasses.
Unless you are already an experienced Smalltalk programmer, both the idea of metaclasses and the role that they play in the language are probably unclear. The Blue Book contains a discussion that might help to sort out the subject. The good news is that most developers, even those who write very sophisticated Smalltalk programs, never have to deal explicitly with metaclasses. They exist only in the background, part of the hidden machinery that makes things work.
CLIM is intended to be used by application developers who are implementing
Smalltalk development tools. CLIM complements the messages described in
CLDT, most of which define either instance behavior, or class behavior that is
specific to one or a few related classes. CLIM consists of the concrete
classes Class, Metaclass, Compiler,
ClimCompilerError, CompiledMethod, and
EmSystemConfiguration. In addition, it adds several messages
for creating classes to the CLDT class UndefinedObject, and extends
the classes Array, String and
DBString. In the same way that it is convenient to include
the abstract class Object in CLDT, we have also included the class
Behavior in CLIM. Behavior describes a number of
messages that are shared by Class and Metaclass, and
through inheritance, by all of the classes in IBM Smalltalk. The class
hierarchy is:
Behavior
ClassDescription
Class
Metaclass
CLIM does not provide a complete definition of Class or Metaclass. What it does do is define a number of common class messages that are supported by all classes in IBM Smalltalk. As might be guessed, CLIM has rather specific objectives. It is intended to support:
It is not intended to support:
It is expected that developers who want to add, modify, or delete methods to IBM Smalltalk classes will normally do so using the source code management facilities. However, there are cases where it might be necessary to add or delete methods outside the control of the source code manager. An example might be behavior that is defined by an application at run time, compiled into a method that is added to some class, run, and then deleted. (However, CLIM classes are not included in the runtime environment.) This is how the Execute command in text menus is often implemented. CLIM provides a minimal set of messages intended to address this specific requirement. It does not, however, include any messages that store source code. Developers are cautioned that when they are adding or deleting methods outside the control of the source code manager, it is their responsibility to leave the system in a well-defined and consistent state.