diff options
| author | Stefan Monnier | 2017-02-28 11:11:01 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2017-02-28 11:11:01 -0500 |
| commit | 0fa594172709770a431121360f8f122df14d6259 (patch) | |
| tree | 10775b677d5899dda45ee24976793973becbf889 /doc | |
| parent | 8d7a3f489082e2aaf4ff238613a497cc03d833ae (diff) | |
| download | emacs-0fa594172709770a431121360f8f122df14d6259.tar.gz emacs-0fa594172709770a431121360f8f122df14d6259.zip | |
* doc/misc/eieio.texi: Update to account for the cl-generic facilities
(Quick Start, Class Options, Generics): Adjust names for cl-generic.
(Methods): Document cl-defmethod.
Explain in more detail the order in which the various
methods are executed. Document the conditions under which a method
is redefined. Remove reference to `eieio-generic-call-arglst`.
Don't document the precise return value of cl-next-method-p.
(Static Methods): Adjust to use `subclass` specializer.
(Method Invocation): Use cl-call-next-method and drop mention of :primary.
(Signal Handling, Signals): Adjust names and args for cl-generic; add
cl-no-primary-method.
(CLOS compatibility, Wish List): Adjust to new featureset.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/misc/eieio.texi | 238 |
1 files changed, 121 insertions, 117 deletions
diff --git a/doc/misc/eieio.texi b/doc/misc/eieio.texi index 3820bd50dfc..ce31bc84b4e 100644 --- a/doc/misc/eieio.texi +++ b/doc/misc/eieio.texi | |||
| @@ -112,7 +112,7 @@ three slots named @code{name}, @code{birthday}, and @code{phone}: | |||
| 112 | Each class can have methods, which are defined like this: | 112 | Each class can have methods, which are defined like this: |
| 113 | 113 | ||
| 114 | @example | 114 | @example |
| 115 | (defmethod call-record ((rec record) &optional scriptname) | 115 | (cl-defmethod call-record ((rec record) &optional scriptname) |
| 116 | "Dial the phone for the record REC. | 116 | "Dial the phone for the record REC. |
| 117 | Execute the program SCRIPTNAME to dial the phone." | 117 | Execute the program SCRIPTNAME to dial the phone." |
| 118 | (message "Dialing the phone for %s" (oref rec name)) | 118 | (message "Dialing the phone for %s" (oref rec name)) |
| @@ -170,7 +170,7 @@ or | |||
| 170 | In these examples, @eieio{} automatically examines the class of | 170 | In these examples, @eieio{} automatically examines the class of |
| 171 | @code{rec}, and ensures that the method defined above is called. If | 171 | @code{rec}, and ensures that the method defined above is called. If |
| 172 | @code{rec} is some other class lacking a @code{call-record} method, or | 172 | @code{rec} is some other class lacking a @code{call-record} method, or |
| 173 | some other data type, Emacs signals a @code{no-method-definition} | 173 | some other data type, Emacs signals a @code{cl-no-applicable-method} |
| 174 | error. @ref{Signals}. | 174 | error. @ref{Signals}. |
| 175 | 175 | ||
| 176 | @node Introduction | 176 | @node Introduction |
| @@ -589,9 +589,9 @@ This option is specific to Emacs, and is not in the CLOS spec. | |||
| 589 | 589 | ||
| 590 | @item :method-invocation-order | 590 | @item :method-invocation-order |
| 591 | This controls the order in which method resolution occurs for | 591 | This controls the order in which method resolution occurs for |
| 592 | @code{:primary} methods in cases of multiple inheritance. The order | 592 | methods in cases of multiple inheritance. The order |
| 593 | affects which method is called first in a tree, and if | 593 | affects which method is called first in a tree, and if |
| 594 | @code{call-next-method} is used, it controls the order in which the | 594 | @code{cl-call-next-method} is used, it controls the order in which the |
| 595 | stack of methods are run. | 595 | stack of methods are run. |
| 596 | 596 | ||
| 597 | Valid values are: | 597 | Valid values are: |
| @@ -817,19 +817,19 @@ provides a function binding and the base documentation for the method | |||
| 817 | symbol (@pxref{Symbol Components,,,elisp,GNU Emacs Lisp Reference | 817 | symbol (@pxref{Symbol Components,,,elisp,GNU Emacs Lisp Reference |
| 818 | Manual}). | 818 | Manual}). |
| 819 | 819 | ||
| 820 | @defmac defgeneric method arglist [doc-string] | 820 | @defmac cl-defgeneric method arglist [doc-string] |
| 821 | This macro turns the (unquoted) symbol @var{method} into a function. | 821 | This macro turns the (unquoted) symbol @var{method} into a function. |
| 822 | @var{arglist} is the default list of arguments to use (not implemented | 822 | @var{arglist} is the default list of arguments to use (not implemented |
| 823 | yet). @var{doc-string} is the documentation used for this symbol. | 823 | yet). @var{doc-string} is the documentation used for this symbol. |
| 824 | 824 | ||
| 825 | A generic function acts as a placeholder for methods. There is no | 825 | A generic function acts as a placeholder for methods. There is no |
| 826 | need to call @code{defgeneric} yourself, as @code{defmethod} will call | 826 | need to call @code{cl-defgeneric} yourself, as @code{cl-defmethod} will call |
| 827 | it if necessary. Currently the argument list is unused. | 827 | it if necessary. Currently the argument list is unused. |
| 828 | 828 | ||
| 829 | @code{defgeneric} signals an error if you attempt to turn an existing | 829 | @code{cl-defgeneric} signals an error if you attempt to turn an existing |
| 830 | Emacs Lisp function into a generic function. | 830 | Emacs Lisp function into a generic function. |
| 831 | 831 | ||
| 832 | You can also create a generic method with @code{defmethod} | 832 | You can also create a generic method with @code{cl-defmethod} |
| 833 | (@pxref{Methods}). When a method is created and there is no generic | 833 | (@pxref{Methods}). When a method is created and there is no generic |
| 834 | method in place with that name, then a new generic will be created, | 834 | method in place with that name, then a new generic will be created, |
| 835 | and the new method will use it. | 835 | and the new method will use it. |
| @@ -842,31 +842,26 @@ only occurs for the first argument, so the @var{arglist} is not used. | |||
| 842 | @node Methods | 842 | @node Methods |
| 843 | @section Methods | 843 | @section Methods |
| 844 | 844 | ||
| 845 | A method is a function that is executed if the first argument passed | 845 | A method is a function that is executed if the arguments passed |
| 846 | to it matches the method's class. Different @eieio{} classes may | 846 | to it matches the method's specializers. Different @eieio{} classes may |
| 847 | share the same method names. | 847 | share the same method names. |
| 848 | 848 | ||
| 849 | Methods are created with the @code{defmethod} macro, which is similar | 849 | Methods are created with the @code{cl-defmethod} macro, which is similar |
| 850 | to @code{defun}. | 850 | to @code{defun}. |
| 851 | 851 | ||
| 852 | @defmac defmethod method [:before | :primary | :after | :static ] arglist [doc-string] forms | 852 | @defmac cl-defmethod method [:before | :around | :after ] arglist [doc-string] forms |
| 853 | 853 | ||
| 854 | @var{method} is the name of the function to create. | 854 | @var{method} is the name of the function to create. |
| 855 | 855 | ||
| 856 | @code{:before} and @code{:after} specify execution order (i.e., when | 856 | @code{:before}, @code{:around}, and @code{:after} specify execution order |
| 857 | this form is called). If neither of these symbols are present, the | 857 | (i.e., when this form is called). If none of these symbols are present, the |
| 858 | default priority is used (before @code{:after} and after | 858 | method is said to be a @emph{primary}. |
| 859 | @code{:before}); this default priority is represented in CLOS as | ||
| 860 | @code{:primary}. | ||
| 861 | 859 | ||
| 862 | @b{Note:} The @code{:BEFORE}, @code{:PRIMARY}, @code{:AFTER}, and | 860 | @var{arglist} is the list of arguments to this method. The mandatory arguments |
| 863 | @code{:STATIC} method tags were in all capital letters in previous | 861 | in this list may have a type specializer (see the example below) which means |
| 864 | versions of @eieio{}. | 862 | that the method will only apply when those arguments match the given type |
| 865 | 863 | specializer. An argument with no type specializer means that the method | |
| 866 | @var{arglist} is the list of arguments to this method. The first | 864 | applies regardless of its value. |
| 867 | argument in this list---and @emph{only} the first argument---may have | ||
| 868 | a type specifier (see the example below). If no type specifier is | ||
| 869 | supplied, the method applies to any object. | ||
| 870 | 865 | ||
| 871 | @var{doc-string} is the documentation attached to the implementation. | 866 | @var{doc-string} is the documentation attached to the implementation. |
| 872 | All method doc-strings are incorporated into the generic method's | 867 | All method doc-strings are incorporated into the generic method's |
| @@ -881,7 +876,7 @@ In the following example, we create a method @code{mymethod} for the | |||
| 881 | @code{classname} class: | 876 | @code{classname} class: |
| 882 | 877 | ||
| 883 | @example | 878 | @example |
| 884 | (defmethod mymethod ((obj classname) secondarg) | 879 | (cl-defmethod mymethod ((obj classname) secondarg) |
| 885 | "Doc string" ) | 880 | "Doc string" ) |
| 886 | @end example | 881 | @end example |
| 887 | 882 | ||
| @@ -889,84 +884,86 @@ In the following example, we create a method @code{mymethod} for the | |||
| 889 | This method only executes if the @var{obj} argument passed to it is an | 884 | This method only executes if the @var{obj} argument passed to it is an |
| 890 | @eieio{} object of class @code{classname}. | 885 | @eieio{} object of class @code{classname}. |
| 891 | 886 | ||
| 892 | A method with no type specifier is a @dfn{default method}. If a given | 887 | A method with no type specializer is a @dfn{default method}. If a given |
| 893 | class has no implementation, then the default method is called when | 888 | class has no implementation, then the default method is called when |
| 894 | that method is used on a given object of that class. | 889 | that method is used on a given object of that class. |
| 895 | 890 | ||
| 896 | Only one default method per execution specifier (@code{:before}, | 891 | Only one method per combination of specializers and qualifiers (@code{:before}, |
| 897 | @code{:primary}, or @code{:after}) is allowed. If two | 892 | @code{:around}, or @code{:after}) is kept. If two @code{cl-defmethod}s appear |
| 898 | @code{defmethod}s appear with @var{arglist}s lacking a type specifier, | 893 | with the same specializers and the same qualifiers, then the second |
| 899 | and having the same execution specifier, then the first implementation | 894 | implementation replaces the first. |
| 900 | is replaced. | ||
| 901 | 895 | ||
| 902 | When a method is called on an object, but there is no method specified | 896 | When a method is called on an object, but there is no method specified |
| 903 | for that object, but there is a method specified for object's parent | 897 | for that object, but there is a method specified for object's parent |
| 904 | class, the parent class' method is called. If there is a method | 898 | class, the parent class's method is called. If there is a method |
| 905 | defined for both, only the child's method is called. A child method | 899 | defined for both, only the child's method is called. A child method |
| 906 | may call a parent's method using @code{call-next-method}, described | 900 | may call a parent's method using @code{cl-call-next-method}, described |
| 907 | below. | 901 | below. |
| 908 | 902 | ||
| 909 | If multiple methods and default methods are defined for the same | 903 | If multiple methods and default methods are defined for the same |
| 910 | method and class, they are executed in this order: | 904 | method and class, they are executed in this order: |
| 911 | 905 | ||
| 912 | @enumerate | 906 | @enumerate |
| 913 | @item method :before | 907 | @item :around methods |
| 914 | @item default :before | 908 | The most specific @code{:around} method is called first, which may invoke the |
| 915 | @item method :primary | 909 | less specific ones via @code{cl-call-next-method}. If it doesn't invoke |
| 916 | @item default :primary | 910 | @code{cl-call-next-method}, then no other methods will be executed. When there |
| 917 | @item method :after | 911 | are no more @code{:around} methods to call, falls through to run the other |
| 918 | @item default :after | 912 | (non-@code{:around}) methods. |
| 913 | @item :before methods | ||
| 914 | Called in sequence from most specific to least specific. | ||
| 915 | @item primary methods | ||
| 916 | The most specific method is called, which may invoke the less specific | ||
| 917 | ones via @code{cl-call-next-method}. | ||
| 918 | @item :after methods | ||
| 919 | Called in sequence from least specific to most specific. | ||
| 919 | @end enumerate | 920 | @end enumerate |
| 920 | 921 | ||
| 921 | If no methods exist, Emacs signals a @code{no-method-definition} | 922 | If no methods exist, Emacs signals a @code{cl-no-applicable-method} error. |
| 922 | error. @xref{Signals}. | 923 | @xref{Signals}. If methods exist but none of them are primary, Emacs |
| 924 | signals a @code{cl-no-primary-method} error. @xref{Signals}. | ||
| 923 | 925 | ||
| 924 | @defun call-next-method &rest replacement-args | 926 | @defun cl-call-next-method &rest replacement-args |
| 925 | @anchor{call-next-method} | 927 | @anchor{cl-call-next-method} |
| 926 | 928 | ||
| 927 | This function calls the superclass method from a subclass method. | 929 | This function calls the superclass method from a subclass method. |
| 928 | This is the ``next method'' specified in the current method list. | 930 | This is the ``next method'' specified in the current method list. |
| 929 | 931 | ||
| 930 | If @var{replacement-args} is non-@code{nil}, then use them instead of | 932 | If @var{replacement-args} is non-@code{nil}, then use them instead of the |
| 931 | @code{eieio-generic-call-arglst}. At the top level, the generic | 933 | arguments originally provided to the method. |
| 932 | argument list is passed in. | ||
| 933 | 934 | ||
| 934 | Use @code{next-method-p} to find out if there is a next method to | 935 | Can only be used from within the lexical body of a primary or around method. |
| 935 | call. | ||
| 936 | @end defun | 936 | @end defun |
| 937 | 937 | ||
| 938 | @defun next-method-p | 938 | @defun cl-next-method-p |
| 939 | @anchor{next-method-p} | 939 | @anchor{cl-next-method-p} |
| 940 | Non-@code{nil} if there is a next method. | 940 | Non-@code{nil} if there is a next method. |
| 941 | Returns a list of lambda expressions which is the @code{next-method} | ||
| 942 | order. | ||
| 943 | @end defun | ||
| 944 | |||
| 945 | At present, @eieio{} does not implement all the features of CLOS: | ||
| 946 | 941 | ||
| 947 | @enumerate | 942 | Can only be used from within the lexical body of a primary or around method. |
| 948 | @item | 943 | @end defun |
| 949 | There is currently no @code{:around} tag. | ||
| 950 | @item | ||
| 951 | CLOS allows multiple sets of type-cast arguments, but @eieio{} only | ||
| 952 | allows the first argument to be cast. | ||
| 953 | @end enumerate | ||
| 954 | 944 | ||
| 955 | @node Static Methods | 945 | @node Static Methods |
| 956 | @section Static Methods | 946 | @section Static Methods |
| 957 | 947 | ||
| 958 | Static methods do not depend on an object instance, but instead | 948 | Static methods do not depend on an object instance, but instead |
| 959 | operate on a class. You can create a static method by using | 949 | operate on a class. You can create a static method by using |
| 960 | the @code{:static} key with @code{defmethod}. | 950 | the @code{subclass} specializer with @code{cl-defmethod}: |
| 951 | |||
| 952 | @example | ||
| 953 | (cl-defmethod make-instance ((class (subclass mychild)) &rest args) | ||
| 954 | (let ((new (cl-call-next-method))) | ||
| 955 | (push new all-my-children) | ||
| 956 | new)) | ||
| 957 | @end example | ||
| 961 | 958 | ||
| 962 | The first argument of a @code{:static} method will be a class rather than an | 959 | The first argument of a static method will be a class rather than an |
| 963 | object. Use the functions @code{oref-default} or @code{oset-default} which | 960 | object. Use the functions @code{oref-default} or @code{oset-default} which |
| 964 | will work on a class. | 961 | will work on a class. |
| 965 | 962 | ||
| 966 | A class's @code{make-instance} method is defined as a @code{:static} | 963 | A class's @code{make-instance} method is defined as a static |
| 967 | method. | 964 | method. |
| 968 | 965 | ||
| 969 | @b{Note:} The @code{:static} keyword is unique to @eieio{}. | 966 | @b{Note:} The @code{subclass} specializer is unique to @eieio{}. |
| 970 | 967 | ||
| 971 | @c TODO - Write some more about static methods here | 968 | @c TODO - Write some more about static methods here |
| 972 | 969 | ||
| @@ -977,9 +974,9 @@ When classes are defined, you can specify the | |||
| 977 | @code{:method-invocation-order}. This is a feature specific to EIEIO. | 974 | @code{:method-invocation-order}. This is a feature specific to EIEIO. |
| 978 | 975 | ||
| 979 | This controls the order in which method resolution occurs for | 976 | This controls the order in which method resolution occurs for |
| 980 | @code{:primary} methods in cases of multiple inheritance. The order | 977 | methods in cases of multiple inheritance. The order |
| 981 | affects which method is called first in a tree, and if | 978 | affects which method is called first in a tree, and if |
| 982 | @code{call-next-method} is used, it controls the order in which the | 979 | @code{cl-call-next-method} is used, it controls the order in which the |
| 983 | stack of methods are run. | 980 | stack of methods are run. |
| 984 | 981 | ||
| 985 | The original EIEIO order turned out to be broken for multiple | 982 | The original EIEIO order turned out to be broken for multiple |
| @@ -1297,8 +1294,7 @@ class. | |||
| 1297 | 1294 | ||
| 1298 | @defmethod eieio-instance-tracker initialize-instance obj slot | 1295 | @defmethod eieio-instance-tracker initialize-instance obj slot |
| 1299 | This method is defined as an @code{:after} method. | 1296 | This method is defined as an @code{:after} method. |
| 1300 | It adds new instances to the master list. Do not overload this method | 1297 | It adds new instances to the master list. |
| 1301 | unless you use @code{call-next-method.} | ||
| 1302 | @end defmethod | 1298 | @end defmethod |
| 1303 | 1299 | ||
| 1304 | @defmethod eieio-instance-tracker delete-instance obj | 1300 | @defmethod eieio-instance-tracker delete-instance obj |
| @@ -1582,7 +1578,7 @@ Additional useful methods defined on the base subclass are: | |||
| 1582 | Make a copy of @var{obj}, and then apply @var{params}. | 1578 | Make a copy of @var{obj}, and then apply @var{params}. |
| 1583 | @var{params} is a parameter list of the same form as @var{initialize-instance} | 1579 | @var{params} is a parameter list of the same form as @var{initialize-instance} |
| 1584 | which are applied to change the object. When overloading @dfn{clone}, be | 1580 | which are applied to change the object. When overloading @dfn{clone}, be |
| 1585 | sure to call @dfn{call-next-method} first and modify the returned object. | 1581 | sure to call @dfn{cl-call-next-method} first and modify the returned object. |
| 1586 | @end defun | 1582 | @end defun |
| 1587 | 1583 | ||
| 1588 | @defun object-print this &rest strings | 1584 | @defun object-print this &rest strings |
| @@ -1595,7 +1591,7 @@ It is sometimes useful to put a summary of the object into the | |||
| 1595 | default #<notation> string when using eieio browsing tools. | 1591 | default #<notation> string when using eieio browsing tools. |
| 1596 | 1592 | ||
| 1597 | Implement this function and specify @var{strings} in a call to | 1593 | Implement this function and specify @var{strings} in a call to |
| 1598 | @dfn{call-next-method} to provide additional summary information. | 1594 | @dfn{cl-call-next-method} to provide additional summary information. |
| 1599 | When passing in extra strings from child classes, always remember | 1595 | When passing in extra strings from child classes, always remember |
| 1600 | to prepend a space. | 1596 | to prepend a space. |
| 1601 | 1597 | ||
| @@ -1604,10 +1600,11 @@ to prepend a space. | |||
| 1604 | (value) | 1600 | (value) |
| 1605 | "Object containing one data slot.") | 1601 | "Object containing one data slot.") |
| 1606 | 1602 | ||
| 1607 | (defmethod object-print ((this data-object) &optional strings) | 1603 | (cl-defmethod object-print ((this data-object) &optional strings) |
| 1608 | "Return a string with a summary of the data object as part of the name." | 1604 | "Return a string with a summary of the data object as part of the name." |
| 1609 | (apply 'call-next-method this | 1605 | (apply #'cl-call-next-method this |
| 1610 | (cons (format " value: %s" (render this)) strings))) | 1606 | (format " value: %s" (render this)) |
| 1607 | strings)) | ||
| 1611 | @end example | 1608 | @end example |
| 1612 | 1609 | ||
| 1613 | Here is what some output could look like: | 1610 | Here is what some output could look like: |
| @@ -1667,24 +1664,36 @@ In @var{clos}, the argument list is (@var{class} @var{object} @var{slot-name}), | |||
| 1667 | @var{eieio} can only dispatch on the first argument, so the first two are swapped. | 1664 | @var{eieio} can only dispatch on the first argument, so the first two are swapped. |
| 1668 | @end defun | 1665 | @end defun |
| 1669 | 1666 | ||
| 1670 | @defun no-applicable-method object method &rest args | 1667 | @defun cl-no-applicable-method generic &rest args |
| 1671 | @anchor{no-applicable-method} | 1668 | @anchor{cl-no-applicable-method} |
| 1672 | Called if there are no implementations for @var{object} in @var{method}. | 1669 | Called if there are no methods applicable for @var{args} in the generic |
| 1673 | @var{object} is the object which has no method implementation. | 1670 | function @var{generic}. |
| 1674 | @var{args} are the arguments that were passed to @var{method}. | 1671 | @var{args} are the arguments that were passed to @var{generic}. |
| 1675 | 1672 | ||
| 1676 | Implement this for a class to block this signal. The return | 1673 | Implement this for a class to block this signal. The return |
| 1677 | value becomes the return value of the original method call. | 1674 | value becomes the return value of the original method call. |
| 1678 | @end defun | 1675 | @end defun |
| 1679 | 1676 | ||
| 1680 | @defun no-next-method object &rest args | 1677 | @defun cl-no-primary-method generic &rest args |
| 1681 | @anchor{no-next-method} | 1678 | @anchor{cl-no-primary-method} |
| 1682 | Called from @dfn{call-next-method} when no additional methods are available. | 1679 | Called if there are methods applicable for @var{args} in the generic |
| 1683 | @var{object} is othe object being called on @dfn{call-next-method}. | 1680 | function @var{generic} but they are all qualified. |
| 1681 | @var{args} are the arguments that were passed to @var{generic}. | ||
| 1682 | |||
| 1683 | Implement this for a class to block this signal. The return | ||
| 1684 | value becomes the return value of the original method call. | ||
| 1685 | @end defun | ||
| 1686 | |||
| 1687 | @defun cl-no-next-method generic method &rest args | ||
| 1688 | @anchor{cl-no-next-method} | ||
| 1689 | Called from @dfn{cl-call-next-method} when no additional methods are available. | ||
| 1690 | @var{generic} is the generic function being called on | ||
| 1691 | @dfn{cl-call-next-method}, @var{method} is the method where | ||
| 1692 | @dfn{cl-call-next-method} was called, and | ||
| 1684 | @var{args} are the arguments it is called by. | 1693 | @var{args} are the arguments it is called by. |
| 1685 | This method signals @dfn{no-next-method} by default. Override this | 1694 | This method signals @dfn{cl-no-next-method} by default. Override this |
| 1686 | method to not throw an error, and its return value becomes the | 1695 | method to not throw an error, and its return value becomes the |
| 1687 | return value of @dfn{call-next-method}. | 1696 | return value of @dfn{cl-call-next-method}. |
| 1688 | @end defun | 1697 | @end defun |
| 1689 | 1698 | ||
| 1690 | @node Signals | 1699 | @node Signals |
| @@ -1699,23 +1708,29 @@ This signal is called when an attempt to reference a slot in an | |||
| 1699 | it. | 1708 | it. |
| 1700 | @end deffn | 1709 | @end deffn |
| 1701 | 1710 | ||
| 1702 | @deffn Signal no-method-definition method arguments | 1711 | @deffn Signal cl-no-applicable-method generic arguments |
| 1703 | This signal is called when @var{method} is called, with @var{arguments} | 1712 | This signal is called when @var{generic} is called, with @var{arguments} |
| 1704 | and nothing is resolved. This occurs when @var{method} has been | 1713 | and nothing is resolved. This occurs when @var{generic} has been |
| 1705 | defined, but the arguments make it impossible for @eieio{} to determine | 1714 | defined, but the arguments make it impossible for @eieio{} to determine |
| 1706 | which method body to run. | 1715 | which method body to run. |
| 1707 | 1716 | ||
| 1708 | To prevent this signal from occurring in your class, implement the | 1717 | To prevent this signal from occurring in your class, implement the |
| 1709 | method @code{no-applicable-method} for your class. This method is | 1718 | method @code{cl-no-applicable-method} for your class. This method is |
| 1710 | called when to throw this signal, so implementing this for your class | 1719 | called when to throw this signal, so implementing this for your class |
| 1711 | allows you block the signal, and perform some work. | 1720 | allows you block the signal, and perform some work. |
| 1712 | @end deffn | 1721 | @end deffn |
| 1713 | 1722 | ||
| 1714 | @deffn Signal no-next-method class arguments | 1723 | @deffn Signal cl-no-primary-method generic arguments |
| 1715 | This signal is called if the function @code{call-next-method} is called | 1724 | Like @code{cl-no-applicable-method} but applies when there are some applicable |
| 1725 | methods, but none of them are primary. You can similarly block it by | ||
| 1726 | implementing a @code{cl-no-primary-method} method. | ||
| 1727 | @end deffn | ||
| 1728 | |||
| 1729 | @deffn Signal cl-no-next-method class arguments | ||
| 1730 | This signal is called if the function @code{cl-call-next-method} is called | ||
| 1716 | and there is no next method to be called. | 1731 | and there is no next method to be called. |
| 1717 | 1732 | ||
| 1718 | Overload the method @code{no-next-method} to protect against this signal. | 1733 | Overload the method @code{cl-no-next-method} to protect against this signal. |
| 1719 | @end deffn | 1734 | @end deffn |
| 1720 | 1735 | ||
| 1721 | @deffn Signal invalid-slot-type slot spec value | 1736 | @deffn Signal invalid-slot-type slot spec value |
| @@ -1796,22 +1811,17 @@ Make instance works as expected, however it just uses the @eieio{} instance | |||
| 1796 | creator automatically generated when a new class is created. | 1811 | creator automatically generated when a new class is created. |
| 1797 | @xref{Making New Objects}. | 1812 | @xref{Making New Objects}. |
| 1798 | 1813 | ||
| 1799 | @item defgeneric | 1814 | @item cl-defgeneric |
| 1800 | Creates the desired symbol, and accepts all of the expected arguments | 1815 | Creates the desired symbol, and accepts most of the expected arguments of |
| 1801 | except @code{:around}. | 1816 | CLOS's @code{defgeneric}. |
| 1802 | 1817 | ||
| 1803 | @item defmethod | 1818 | @item cl-defmethod |
| 1804 | Calls defgeneric, and accepts most of the expected arguments. Only | 1819 | Accepts most of the expected arguments of CLOS's @code{defmethod}. To type |
| 1805 | the first argument to the created method may have a type specifier. | 1820 | cast against a class, the class must exist before @code{cl-defmethod} |
| 1806 | To type cast against a class, the class must exist before defmethod is | 1821 | is called. |
| 1807 | called. In addition, the @code{:around} tag is not supported. | 1822 | |
| 1808 | 1823 | @item cl-call-next-method | |
| 1809 | @item call-next-method | 1824 | Works just like CLOS's @code{call-next-method}. |
| 1810 | Inside a method, calls the next available method up the inheritance tree | ||
| 1811 | for the given object. This is different than that found in CLOS because | ||
| 1812 | in @eieio{} this function accepts replacement arguments. This permits | ||
| 1813 | subclasses to modify arguments as they are passed up the tree. If no | ||
| 1814 | arguments are given, the expected CLOS behavior is used. | ||
| 1815 | @end table | 1825 | @end table |
| 1816 | 1826 | ||
| 1817 | CLOS supports the @code{describe} command, but @eieio{} provides | 1827 | CLOS supports the @code{describe} command, but @eieio{} provides |
| @@ -1834,13 +1844,7 @@ Some important compatibility features that would be good to add are: | |||
| 1834 | 1844 | ||
| 1835 | @enumerate | 1845 | @enumerate |
| 1836 | @item | 1846 | @item |
| 1837 | Support for metaclasses and EQL specialization. | 1847 | Support for metaclasses. |
| 1838 | @item | ||
| 1839 | @code{:around} method key. | ||
| 1840 | @item | ||
| 1841 | Method dispatch for built-in types. | ||
| 1842 | @item | ||
| 1843 | Method dispatch for multiple argument typing. | ||
| 1844 | @item | 1848 | @item |
| 1845 | Improve integration with the @file{cl} package. | 1849 | Improve integration with the @file{cl} package. |
| 1846 | @end enumerate | 1850 | @end enumerate |