Replace *-function vars with generic functions in cl-generic.
* lisp/emacs-lisp/cl-generic.el (cl--generic-generalizer): New struct. (cl-generic-tagcode-function, cl-generic-tag-types-function): Remove. (cl--generic-t-generalizer): New const. (cl--generic-make-method): Rename from `cl--generic-method-make'. (cl--generic-make): Change calling convention. (cl--generic): Add `options' field. (cl-generic-function-options): New function. (cl-defgeneric): Rewrite handling of options. Add support for :method options and allow the use of a default body. (cl-generic-define): Save options in the corresponding new field. (cl-defmethod): Fix ordering of qualifiers. (cl-generic-define-method): Use cl-generic-generalizers. (cl--generic-get-dispatcher): Change calling convention, and change calling convention of the returned function as well so as to take the list of methods separately from the generic function object, so that it can receive the original generic function object. (cl--generic-make-next-function): New function, extracted from cl--generic-make-function. (cl--generic-make-function): Use it. (cl-generic-method-combination-function): Remove. (cl--generic-cyclic-definition): New error. (cl-generic-call-method): Take a generic function object rather than its name. (cl-method-qualifiers): New alias. (cl--generic-build-combined-method): Use cl-generic-combine-methods, don't segregate by qualifiers here any more. (cl--generic-standard-method-combination): Segregate by qualifiers here instead. Add support for the `:extra' qualifier. (cl--generic-cache-miss): Move earlier, adjust to new calling convention. (cl-generic-generalizers, cl-generic-combine-methods): New generic functions. (cl-no-next-method, cl-no-applicable-method, cl-no-primary-method): Use the new "default method in defgeneric" functionality, change calling convention to receive a generic function object. (cl--generic-head-used): New var. (cl--generic-head-generalizer, cl--generic-eql-generalizer) (cl--generic-struct-generalizer, cl--generic-typeof-generalizer): New consts. * lisp/emacs-lisp/eieio-core.el (eieio--generic-generalizer) (eieio--generic-subclass-generalizer): New consts. (cl-generic-generalizers): New methods. * lisp/emacs-lisp/eieio-compat.el (eieio--generic-static-symbol-generalizer) (eieio--generic-static-object-generalizer): New consts. (cl-generic-generalizers) <(head eieio--static)>: New method. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Unfold closures like lambdas.
Showing with 504 additions and 307 deletions