Old versionsSee all
Lpp (Lisp Plus Plus), is a library of Lisp like functions and macros usable in C++ programs. The philosophy behind Lpp is to provide as close as possible the semantics and style of Lisp rather than try to force it to fit a static style of programming. Lpp tries to emulate Common Lisp as much as possible in this regard. By doing things this way part of the true power and flexibility of Lisp can coexist and mix with the static typing features of C++ even within functions and objects.
One of Lisp's advertised benefits is that of dynamically typed objects. Standard C++ does not offer this capability. Instead, the programmer is expected to created virtual functions whose objects dynamically dispatch through the use of indirect pointers to v-tables and then a v-table has a pointer to the virtual function for that object. While the basic idea of virtual functions is good, relying only on it for real world complex problems presents difficulties. One such problem is that it is impossible to write true generic code using virtual functions since all possible types must be accounted for. The default virtual function of a base class can only serve the declared sub-classes that do not define their own virtual functions. Contrast this with Lisp functions that usually do not have to account for the types of the objects that it operates on. As a very simple example, Lisp can compute the length of a list irrespective of the types of the objects in the list. Furthermore a provider could supply an object dynamically to a consumer of such a list that is not required to be seen by the compiler of the program operating on the list.