Eclipse C: Lisp Concepts for C Programmers


ANSI Common Lisp defines a library of functions, variables and other utilities. For the most part, a C programmer can use these utilities and their documentation without learning a great deal of Lisp terminology and concepts before hand. However, there are a small number of key differences between Lisp and C, which programmers do need to be aware of.

  1. Every Lisp function returns a type-tagged object as its primary value. All arguments to Lisp functions are type-tagged objects. A type-tagged object is one which carries some sort of tagging information that can be examined at run-time to determine the type of the data.

    In Eclipse, all Lisp data is represented in C as a typedef named clObject. Some of these these clObjects are immediate data like a C int, others are created by the system in the heap, and the clObject is effectively a pointer.

  2. The memory for all Lisp data is managed automatically by the system. clObjects are created by Lisp functions as needed, and memory is reclaimed when the system is certain that all references to the clObject have disappeared. The latter is called garbage collection.

  3. There are no programmer-visible pointers in Lisp.

  4. Lisp functions can be defined to have: In all cases, a Lisp user does not provide an explicit argument count or argument terminator -- it is provided internally by the Lisp compiler. Lisp symbols are used to provide the names for the named arguments. All arguments can be thought of as being passed "by value", but recognizing that many clObjects are effectively pointers.

  5. Functions can return zero or more values. However, these values can only be accessed using special constructs. When not using these special multiple-value receiving constructs, all functions return a single primary value.

  6. There is a data type in Lisp called a symbol. To some extent, this can be thought of as filling all of the following roles:

    There is a central database of symbols, and programs may ask the database to return the symbol with a given name -- or create a new one if it doesn't yet exist -- by calling the function intern.

  7. In order to support all these features, each Lisp source file defines some initialization behavior which is said to occur at the point the Lisp file is loaded into a running Lisp. This includes the interning of symbols and the assignment of properties on those symbols.
How these features are handled in Eclipse is described in "Eclipse Lisp Implementation".
[Previous] [Next] [Up] [Documentation Contents] [Eclipse Home Page]