cl-parametric-types
[BETA] A tool to repeatedly compile the same source code with different types. This library adds C++-style template classes, structs and functions to Common Lisp. Written by Massimiliano Ghilardi, maintainer of stmx.

Currently (2018-03-06) tested on SBCL, ABCL, CCL, CLISP and CMUCL.

For rationale, see the following excerpt from the homepage:

  • C++ templates are very useful: somebody can implement general algorithms and classes, which can be later specialized by somebody else on concrete cases (instantiated), producing very efficient machine code, without duplicating the source code.
  • Common Lisp does not directly provide any equivalent mechanism, because macros operate on a different level: they can produce arbitrary code, but actually programming them is up to the programmer. Macros are general tools to build a programming language, rather than a specialized tool to repeatedly compile the same source code with different types.
  • If Common Lisp macros are to be considered "better" (for some definition of better) than C++ templates, then it should be possible to implement C++ templates using them.

“This is a very interesting project. […] I see a utility problem similar to pre-quicklisp era. There are bunch of datastructure libraries but it's hard to say CL has the enough number of reliable, benchmarked, extensible SoA (state-of-art) algorithms/datastructure libraries.” — Matasaro Asai

Homepage: GitHub

License: LLGPL

Topics: language extension