Desain, P. and Honing, H. (1997, draft) Lisp as a second language.

Abstract

Next to Smalltalk, Lisp has been one of the earliest languages to support an object-oriented style, and many ideas, that can now be found in object- oriented extensions of traditional languages (like C++) have developed over the years within the Lisp community. The ideas have come to a consistent and mature definition in CLOS, the Common Lisp Object System. This language replaces many of the precursors (Flavors, Common Loops) and has become widely accepted by users of Common Lisp. It contains, next to standard object-oriented mechanisms (instantiation, inheritance, etc.) more sophisticated concepts (like multiple inheritance, method combination, multi-methods and the meta object protocol) that can become powerful tools in constructing computer music systems and representing musical knowledge. The complexity of the full object oriented extension to Common Lisp can be quite overwhelming, especially when one tries to learn it directly from a concise reference such as Steele (1990). Therefore this paper takes a step by step approach with many small examples, which are constructed for the sake of clarity. The programs presented are not intended as a computer music composition system. They rather show programming techniques that can be used in writing your own. The expose of CLOS constructs is divided into three parts. This first part covers all basic constructs needed for defining classes and creating objects and simple methods that can act on them. It contains enough explanation of the mundane issues for the reader to learn to program in a simple object oriented style. The second part will treat more advanced topics like multi-methods and method combination which makes CLOS so much more powerful than other object-oriented languages and that provide many good tools for structuring and factoring musical knowledge. After mastering this part the reader will be familiar will all aspects of CLOS that one needs for programming in this language. The third part will show how in CLOS the language itself can be extended. This meta approach makes it possible to achieve elegant solutions even when the constructs and mechanisms (e.g. the kind of inheritance) built into the language cannot be used directly for representing the domain in question. Although everyday pedestrian use of CLOS does not often entail working at this level, the concepts of the meta object protocol are of such beauty and power that it will be worthwhile to get acquainted with them a bit. these texts a basic knowledge of Lisp is assumed. Basic list processing, function definitions, recursion, functional arguments, let binding and the loop macro are topics that will be used but not explained here.




www.mcg.uva.nl