quote:Original post by Khaos
Oh yeah, I meant to ask why Lisp can conform to any paradigm. Might someone be able to explain "why" that is? I hope you understand what I mean. What is it about s-expressions that let it conform to OOP or Aspect oriented, etc?
This is the core of what's cool about Lisp, actually. Consider C++: It is a modified and highly complexified version of C that among other things adds some "object oriented" features (encapsulation, inheritance, polymorphism).
Common Lisp itself has absolutely no support for OOP. Its core types do not provide any inheritance or polymorphism capabilities. Enter CLOS, the Common Lisp Object System, an addon library written entirely in Common Lisp, that adds a superset of C++'s OOP features to the base language. This is, of course, accomplished with macros.
What makes this possible is the fact that all Lisp code is Lisp data, in the form of s-expressions. In fact, those lists are really a neat representation of a parse tree for your Lisp code, enabling heavy syntactical transformations in macros. Furthermore, unlike in most other languages, the entire language is available at the time the macros are expanded. The implications of this are a bit difficult to understand at first, but basically this means that Lisp is uniquely suited to making programs that write other programs, or creating embedded languages with a minimum of effort.
[edited by - twix on May 31, 2004 7:15:54 PM]