Hacker News new | ask | show | jobs
Mixins in Common Lisp (lisp.substack.com)
5 points by Abhinav2000 1675 days ago
1 comments

Mixins play nicely with Common Lisp's method combinations, as one can attach a little bit of behavior to each mixin then use MC to weave them together. For example: suppose we want to build classes for the nodes of an abstract syntax tree. We create a mixin for each child slot, and produce a node class by subclassing from the appropriate child slot classes. A traversal function on ASTs assembles traversal methods for these mixin classes using the PROGN method combination.