tailieunhanh - The Art of the Metaobject Protocol- P12

The Art of the Metaobject Protocol- P12: The work described here is synthetic in nature, bringing together techniques and insights from several branches of computer. | 304 Appendix D sub-specializer-p sped spec2 arg-class method-specializers methodi method-specializers method2 required-classes nil apply-methods and compute-effective-method-function defun apply-methods gf args methods funcall compute-effective-method-function gf methods args defun primary-method-p method null method-qualifiers method defun before-method-p method equal before method-qualifiers method defun after-method-p method equal 1 after method-qualifiers method defun around-method-p method equal around method-qualifiers method defun std-compute-effective-method-function gf methods let primaries remove-if-not primary-method-p methods around find-if around-method-p methods when null primaries error No primary methods for the O generic function S. gf if around let next-emfun funcall if eq class-of gf the-class-standard-gf std-compute-effective-method-function compute-effective-method-function gf remove around methods lambda args funcall method-function around args next-emfun let next-emfun compute-primary-emfun cdr primaries befores remove-if-not before-method-p methods reverse-afters reverse remove-if-not after-method-p methods lambda args dolist before befores funcall method-function before args nil multiple-value-progl funcall method-function car primaries args next-emfun A Working Closette Implementation 305 dolist after reverse-afters funcall method-function after args nil compute an effective method function from a list of primary methods defun compute-primary-emfun methods if null methods nil let next-emfun compute-primary-emfun cdr methods lambda args funcall method-function car methods args next-emfun apply-method and compute-method-function defun apply-method method args next-methods funcall method-function method args if null next-methods nil compute-effective-method-function method-generic-function method next-methods defun std-compute-method-function method let form method-body method lambda-list method-lambda-list method .