next up previous
Next: Lists and The ``Cons Up: Emacs Lisp, The Language Previous: Scoping Rules

Lisp Objects and Data Types

Expressions are written as text in a Lisp program. The Lisp system's internal representation of these expressions are referred to as `Lisp Objects'. When an expression is evaluated (say interactively using the C-x C-e key in the scratch buffer), the text of the expression is first read and converted into a ``Lisp object'' and the resulting Lisp object is evaluated. In addition to expressions, there are certain Lisp objects which cannot be represented as text in a lisp program. For e.g. Elisp has a 'Buffer' object that cannot be written as an expression.`

It is very important to keep in mind that the Lisp interpreter acts on lisp objects and not directly on textual expressions.

Although there is no explicit mention of type names anywhere in a Lisp program, like in C or C++, it does not mean Lisp has no types. Each object has a type - atleast one type. Lisp types should be thought of as overlapping universe of objects. Thus one can ask `Is the variable foo of type bar?', but not `what is the type of variable guppy'

Lisp supports a large number of data types; all of which can be grouped into one of two broad categories - the types that have to do with Lisp programming, and those that have to do with editing. The latter are unique to Emacs Lisp, while the former are available in Common Lisp and other dialects, generally speaking. Examples of the former category are integer type, floating point type, character type, symbol type, array type, string type, function type, cons cell type and so on. Recent versions of Emacs have more, like hash table type and so on.

The second category consists of such types as the buffer type, marker type, window type, frame type, process type, overlay type, and so on. These types are used for objects used to save editor state, configuration and so on.



 
next up previous
Next: Lists and The ``Cons Up: Emacs Lisp, The Language Previous: Scoping Rules
Sriram Karra
2005-01-06