:Pascal Bourguignon, speaking of some code being discussed
Also, it doesn't really implement the abstract factory design pattern, because defclass being a macro, that specifies that the metaclass IS the name of the metaclass, not that it is EVALUATED to a name of a metaclass, you cannot create a class with a metaclass in a variable (not directly at least; you could do it using eval and building a defclass form at run-time). Fundamentally defclass is a compilation-time operator, while the abstract factory design pattern is designed to select the concrete classes at run-time.
If you want to define "classes" at runtime rather than compile-time, you may want to use a prototype object system, rather than a class-based object system.
Yale T Scheme in 1981 had one, designed by Jonathan Rees. In Lisp, there have been Object Lisp (1985), ABCL (1986), and more recently Sheeple (2008), dto's CLON (that I can't find anymore), CLPOS (2015), and possibly many more. https://github.com/xach/sheeple https://github.com/DrPyser/Common-Lisp-Prototype-Object-System
I've been building my own prototype object orientation system for Gerbil Scheme, POO, and have been extremely happy using it for over a year. Precisely because I need to generate types or classes at runtime, since my runtime is my users' compile-time. I just added this week multiple inheritance to it with C3 linearization, and it's pretty cool. (I also built a similar system in nixpkgs.)
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org Under democracy one party always devotes its chief energies to trying to prove that the other party is unfit to rule - and both commonly succeed, and are right. — H. L. Mencken