Next: , Previous: , Up: Programming techniques   [Contents][Index]

4.2 Dynamic class generation

Class and method redefinition at runtime is very useful, especially in the development phase of a program, since the same Lisp session is often used during several days or even weeks. But an even more interesting application is the automatic generation of classes and methods at run-time. This may even lead to Common Lisp programs which surpass the efficiency of C code, see e.g. (Neuss 2002).

In FEMLISP, this feature is used at several places. In the package FL.MESH, it is used when dynamically generating cell classes of arbitrary dimension and type. In the package FL.MATLISP, it is used for generating matrices with entries of a given type as well as the corresponding methods. This is somewhat similar to C++ templates which are applied at runtime as soon as a method of a certain signature is needed.