Different computer languages have different strengths and weaknesses. For example, the computer language known as "Objective-C" has the powerful attribute of being "dynamically bound", meaning that method invocations upon an object are resolved at run-time. This approach is in contrast to the computer language known as "C++", which is "statically bound", meaning that method invocations are resolved at compilation time.
While Objective-C enjoys the benefit of being dynamically bound, there are a number of benefits associated with C++. First, C++ provides language support for the automatic construction and destruction of object instances. In C++ there is support in the language itself to automatically initialize an object as a side effect of its definition, and also to destroy it when its definition is no longer in scope. In Objective-C there is no such language support, support is provided by a set of conventions defined in the root object of the language system's class hierarchy. This lack of support requires that the programmer explicitly manage the creation and destruction of Objective-C objects. This process is error-prone, thereby complicating the programmer's tasks.
Another benefit of C++ is that any arbitrary object may be allocated in memory from the program heap or the program stack. Being able to allocate objects on the program stack allows a programmer the freedom to exercise significant performance gains. That is, by allocating objects on the program stack, overhead is avoided for invoking memory allocator functions to obtain and subsequently release memory from the program heap. Objective-C has no provision to allocate objects in memory from the program stack.
Finally, the Interface Definition Language (IDL) promulgated by the Object Management Group supports C++, but not Objective-C. This implies that it is not possible to develop distributable object servers within the Common Object Request Broker Architecture using the Objective-C language as the implementation language.
In view of the foregoing, it would be highly desirable to supplement the strengths of Objective-C with the strengths of C++. More particularly, it would be highly desirable to provide a technique of exploiting the benefits of both Objective-C and C++ in the same source code program.