Settings

Theme

Mixins in Common Lisp

lisp.substack.com

5 points by Abhinav2000 4 years ago · 2 comments

Reader

pfdietz 4 years ago

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.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection