6.1 Generics

Each EIEIO method has one corresponding generic. This generic provides a function binding and the base documentation for the method symbol (see Symbol Components in GNU Emacs Lisp Reference Manual).

Macro: cl-defgeneric method arglist [doc-string]

This macro turns the (unquoted) symbol method into a function. arglist is the default list of arguments to use (not implemented yet). doc-string is the documentation used for this symbol.

A generic function acts as a placeholder for methods. There is no need to call cl-defgeneric yourself, as cl-defmethod will call it if necessary. Currently the argument list is unused.

cl-defgeneric signals an error if you attempt to turn an existing Emacs Lisp function into a generic function.

You can also create a generic method with cl-defmethod (see Methods). When a method is created and there is no generic method in place with that name, then a new generic will be created, and the new method will use it.