On Fri, Dec 2, 2022 at 3:44 PM Stefan Monnier <monnier@iro.umontreal.ca> wrote:
Indeed.  AFAIK the general approach for APIs that rely on CLOS-style OO
programming is that all the classes are kept "abstract" and what you see
is only generic functions.  IOW the API is exclusively defined by the
generic functions.

Yes, and such an API is called a "protocol" in CLOS parlance.  But the
exclusivity you suggest isn't true: classes and inheritance are a big
part of CLOS and CLOS-style OO.  IME,  CLOS's power is only fully
realized when you use both.

In Emacs Lisp's flavour of CLOS,  generic functions have somewhat
esoteric  dispatching mechanisms that I've never seen or needed in a
CLOS system when using classes, inheritance, and method combinations.

So +1 for using classes in more Elisp packages.  See for example how
eglot.el subclasses jsonrpc.el's classes. It's not as easy as in Common
Lisp since we don't have things like the beautiful inspector of SLY/SLIME.
But classes still beat those funky cons by a mile IMHO.

João