]> code.delx.au - gnu-emacs/blob - lisp/emacs-lisp/eieio-core.el
* eieio-core.el (class-abstract-p): Don't inline, to avoid leaking internals
[gnu-emacs] / lisp / emacs-lisp / eieio-core.el
1 ;;; eieio-core.el --- Core implementation for eieio -*- lexical-binding:t -*-
2
3 ;; Copyright (C) 1995-1996, 1998-2015 Free Software Foundation, Inc.
4
5 ;; Author: Eric M. Ludlam <zappo@gnu.org>
6 ;; Version: 1.4
7 ;; Keywords: OO, lisp
8
9 ;; This file is part of GNU Emacs.
10
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
15
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23
24 ;;; Commentary:
25 ;;
26 ;; The "core" part of EIEIO is the implementation for the object
27 ;; system (such as eieio-defclass, or eieio-defmethod) but not the
28 ;; base classes for the object system, which are defined in EIEIO.
29 ;;
30 ;; See the commentary for eieio.el for more about EIEIO itself.
31
32 ;;; Code:
33
34 (require 'cl-lib)
35 (require 'pcase)
36
37 ;;;
38 ;; A few functions that are better in the official EIEIO src, but
39 ;; used from the core.
40 (declare-function slot-unbound "eieio")
41 (declare-function slot-missing "eieio")
42 (declare-function child-of-class-p "eieio")
43 (declare-function same-class-p "eieio")
44 (declare-function object-of-class-p "eieio")
45
46 \f
47 ;;;
48 ;; Variable declarations.
49 ;;
50 (defvar eieio-hook nil
51 "This hook is executed, then cleared each time `defclass' is called.")
52
53 (defvar eieio-error-unsupported-class-tags nil
54 "Non-nil to throw an error if an encountered tag is unsupported.
55 This may prevent classes from CLOS applications from being used with EIEIO
56 since EIEIO does not support all CLOS tags.")
57
58 (defvar eieio-skip-typecheck nil
59 "If non-nil, skip all slot typechecking.
60 Set this to t permanently if a program is functioning well to get a
61 small speed increase. This variable is also used internally to handle
62 default setting for optimization purposes.")
63
64 (defvar eieio-optimize-primary-methods-flag t
65 "Non-nil means to optimize the method dispatch on primary methods.")
66
67 (defvar eieio-backward-compatibility t
68 "If nil, drop support for some behaviors of older versions of EIEIO.
69 Currently under control of this var:
70 - Define every class as a var whose value is the class symbol.
71 - Define <class>-child-p and <class>-list-p predicates.
72 - Allow object names in constructors.")
73
74 (defconst eieio-unbound
75 (if (and (boundp 'eieio-unbound) (symbolp eieio-unbound))
76 eieio-unbound
77 (make-symbol "unbound"))
78 "Uninterned symbol representing an unbound slot in an object.")
79
80 ;; This is a bootstrap for eieio-default-superclass so it has a value
81 ;; while it is being built itself.
82 (defvar eieio-default-superclass nil)
83
84 (progn
85 ;; Arrange for field access not to bother checking if the access is indeed
86 ;; made to an eieio--class object.
87 (cl-declaim (optimize (safety 0)))
88
89 (cl-defstruct (eieio--class
90 (:constructor nil)
91 (:constructor eieio--class-make (name &aux (tag 'defclass)))
92 (:type vector)
93 (:copier nil))
94 ;; We use an untagged cl-struct, with our own hand-made tag as first field
95 ;; (containing the symbol `defclass'). It would be better to use a normal
96 ;; cl-struct with its normal tag (e.g. so that cl-defstruct can define the
97 ;; predicate for us), but that breaks compatibility with .elc files compiled
98 ;; against older versions of EIEIO.
99 tag
100 ;; Fields we could inherit from cl--class (if we used a tagged cl-struct):
101 (name nil :type symbol) ;The type name.
102 (docstring nil :type string)
103 (parents nil :type (or eieio--class (list-of eieio--class)))
104 (slots nil :type (vector cl-slot-descriptor))
105 (index-table nil :type hash-table)
106 ;; Fields specific to EIEIO classes:
107 children
108 initarg-tuples ;; initarg tuples list
109 (class-slots nil :type eieio--slot)
110 class-allocation-values ;; class allocated value vector
111 default-object-cache ;; what a newly created object would look like.
112 ; This will speed up instantiation time as
113 ; only a `copy-sequence' will be needed, instead of
114 ; looping over all the values and setting them from
115 ; the default.
116 options ;; storage location of tagged class option
117 ; Stored outright without modifications or stripping
118 )
119 ;; Set it back to the default value.
120 (cl-declaim (optimize (safety 1))))
121
122
123 (cl-defstruct (eieio--object
124 (:type vector) ;We manage our own tagging system.
125 (:constructor nil)
126 (:copier nil))
127 ;; `class-tag' holds a symbol, which is not the class name, but is instead
128 ;; properly prefixed as an internal EIEIO thingy and which holds the class
129 ;; object/struct in its `symbol-value' slot.
130 class-tag)
131
132 (eval-when-compile
133 (defconst eieio--object-num-slots
134 (length (cl-struct-slot-info 'eieio--object))))
135
136 (defsubst eieio--object-class (obj)
137 (symbol-value (eieio--object-class-tag obj)))
138
139 \f
140 ;;; Important macros used internally in eieio.
141
142 (defmacro eieio--class-v (class) ;Use a macro, so it acts as a GV place.
143 "Internal: Return the class vector from the CLASS symbol."
144 (declare (debug t))
145 ;; No check: If eieio gets this far, it has probably been checked already.
146 `(get ,class 'eieio-class-definition))
147
148 (defsubst eieio--class-object (class)
149 "Return the class object."
150 (if (symbolp class)
151 ;; Keep the symbol if class-v is nil, for better error messages.
152 (or (eieio--class-v class) class)
153 class))
154
155 (defsubst eieio--class-p (class)
156 "Return non-nil if CLASS is a valid class object."
157 (condition-case nil
158 (eq (aref class 0) 'defclass)
159 (error nil)))
160
161 (defun class-p (class)
162 "Return non-nil if CLASS is a valid class vector.
163 CLASS is a symbol." ;FIXME: Is it a vector or a symbol?
164 (and (symbolp class) (eieio--class-p (eieio--class-v class))))
165
166 (defun eieio--class-print-name (class)
167 "Return a printed representation of CLASS."
168 (format "#<class %s>" (eieio-class-name class)))
169
170 (defun eieio-class-name (class)
171 "Return a Lisp like symbol name for CLASS."
172 (setq class (eieio--class-object class))
173 (cl-check-type class eieio--class)
174 (eieio--class-name class))
175 (define-obsolete-function-alias 'class-name #'eieio-class-name "24.4")
176
177 (defalias 'eieio--class-constructor #'identity
178 "Return the symbol representing the constructor of CLASS.")
179
180 (defmacro eieio--class-option-assoc (list option)
181 "Return from LIST the found OPTION, or nil if it doesn't exist."
182 `(car-safe (cdr (memq ,option ,list))))
183
184 (defsubst eieio--class-option (class option)
185 "Return the value stored for CLASS' OPTION.
186 Return nil if that option doesn't exist."
187 (eieio--class-option-assoc (eieio--class-options class) option))
188
189 (defun eieio-object-p (obj)
190 "Return non-nil if OBJ is an EIEIO object."
191 (and (vectorp obj)
192 (> (length obj) 0)
193 (let ((tag (eieio--object-class-tag obj)))
194 (and (symbolp tag)
195 ;; (eq (symbol-function tag) :quick-object-witness-check)
196 (boundp tag)
197 (eieio--class-p (symbol-value tag))))))
198
199 (define-obsolete-function-alias 'object-p 'eieio-object-p "25.1")
200
201 (defun class-abstract-p (class)
202 "Return non-nil if CLASS is abstract.
203 Abstract classes cannot be instantiated."
204 (eieio--class-option (eieio--class-v class) :abstract))
205
206 (defsubst eieio--class-method-invocation-order (class)
207 "Return the invocation order of CLASS.
208 Abstract classes cannot be instantiated."
209 (or (eieio--class-option class :method-invocation-order)
210 :breadth-first))
211
212
213 \f
214 ;;;
215 ;; Class Creation
216
217 (defvar eieio-defclass-autoload-map (make-hash-table)
218 "Symbol map of superclasses we find in autoloads.")
219
220 ;; We autoload this because it's used in `make-autoload'.
221 ;;;###autoload
222 (defun eieio-defclass-autoload (cname _superclasses filename doc)
223 "Create autoload symbols for the EIEIO class CNAME.
224 SUPERCLASSES are the superclasses that CNAME inherits from.
225 DOC is the docstring for CNAME.
226 This function creates a mock-class for CNAME and adds it into
227 SUPERCLASSES as children.
228 It creates an autoload function for CNAME's constructor."
229 ;; Assume we've already debugged inputs.
230
231 ;; We used to store the list of superclasses in the `parent' slot (as a list
232 ;; of class names). But now this slot holds a list of class objects, and
233 ;; those parents may not exist yet, so the corresponding class objects may
234 ;; simply not exist yet. So instead we just don't store the list of parents
235 ;; here in eieio-defclass-autoload at all, since it seems that they're just
236 ;; not needed before the class is actually loaded.
237 (let* ((oldc (eieio--class-v cname))
238 (newc (eieio--class-make cname)))
239 (if (eieio--class-p oldc)
240 nil ;; Do nothing if we already have this class.
241
242 ;; turn this into a usable self-pointing symbol
243 (when eieio-backward-compatibility
244 (set cname cname)
245 (make-obsolete-variable cname (format "use '%s instead" cname) "25.1"))
246
247 ;; Store the new class vector definition into the symbol. We need to
248 ;; do this first so that we can call defmethod for the accessor.
249 ;; The vector will be updated by the following while loop and will not
250 ;; need to be stored a second time.
251 (setf (eieio--class-v cname) newc)
252
253 ;; Create an autoload on top of our constructor function.
254 (autoload cname filename doc nil nil)
255 (autoload (intern (format "%s-p" cname)) filename "" nil nil)
256 (when eieio-backward-compatibility
257 (autoload (intern (format "%s-child-p" cname)) filename "" nil nil)
258 (autoload (intern (format "%s-list-p" cname)) filename "" nil nil)))))
259
260 (defsubst eieio-class-un-autoload (cname)
261 "If class CNAME is in an autoload state, load its file."
262 (autoload-do-load (symbol-function cname))) ; cname
263
264 (cl-deftype list-of (elem-type)
265 `(and list
266 (satisfies (lambda (list)
267 (cl-every (lambda (elem) (cl-typep elem ',elem-type))
268 list)))))
269
270
271 (defun eieio-make-class-predicate (class)
272 (lambda (obj)
273 (:documentation
274 (format "Return non-nil if OBJ is an object of type `%S'.\n\n(fn OBJ)"
275 class))
276 (and (eieio-object-p obj)
277 (same-class-p obj class))))
278
279 (defun eieio-make-child-predicate (class)
280 (lambda (obj)
281 (:documentation
282 (format "Return non-nil if OBJ is an object of type `%S' or a subclass.
283 \n(fn OBJ)" class))
284 (and (eieio-object-p obj)
285 (object-of-class-p obj class))))
286
287 (defun eieio-defclass-internal (cname superclasses slots options)
288 "Define CNAME as a new subclass of SUPERCLASSES.
289 SLOTS are the slots residing in that class definition, and OPTIONS
290 holds the class options.
291 See `defclass' for more information."
292 ;; Run our eieio-hook each time, and clear it when we are done.
293 ;; This way people can add hooks safely if they want to modify eieio
294 ;; or add definitions when eieio is loaded or something like that.
295 (run-hooks 'eieio-hook)
296 (setq eieio-hook nil)
297
298 (let* ((oldc (let ((c (eieio--class-v cname))) (if (eieio--class-p c) c)))
299 (newc (if (and oldc (not (eieio--class-default-object-cache oldc)))
300 ;; The oldc class is a stub setup by eieio-defclass-autoload.
301 ;; Reuse it instead of creating a new one, so that existing
302 ;; references stay valid.
303 oldc
304 (eieio--class-make cname)))
305 (groups nil) ;; list of groups id'd from slots
306 (clearparent nil))
307
308 ;; If this class already existed, and we are updating its structure,
309 ;; make sure we keep the old child list. This can cause bugs, but
310 ;; if no new slots are created, it also saves time, and prevents
311 ;; method table breakage, particularly when the users is only
312 ;; byte compiling an EIEIO file.
313 (if oldc
314 (setf (eieio--class-children newc) (eieio--class-children oldc))
315 ;; If the old class did not exist, but did exist in the autoload map,
316 ;; then adopt those children. This is like the above, but deals with
317 ;; autoloads nicely.
318 (let ((children (gethash cname eieio-defclass-autoload-map)))
319 (when children
320 (setf (eieio--class-children newc) children)
321 (remhash cname eieio-defclass-autoload-map))))
322
323 (if superclasses
324 (progn
325 (dolist (p superclasses)
326 (if (not (and p (symbolp p)))
327 (error "Invalid parent class %S" p)
328 (let ((c (eieio--class-v p)))
329 (if (not (eieio--class-p c))
330 ;; bad class
331 (error "Given parent class %S is not a class" p)
332 ;; good parent class...
333 ;; save new child in parent
334 (cl-pushnew cname (eieio--class-children c))
335 ;; Get custom groups, and store them into our local copy.
336 (mapc (lambda (g) (cl-pushnew g groups :test #'equal))
337 (eieio--class-option c :custom-groups))
338 ;; Save parent in child.
339 (push c (eieio--class-parents newc))))))
340 ;; Reverse the list of our parents so that they are prioritized in
341 ;; the same order as specified in the code.
342 (cl-callf nreverse (eieio--class-parents newc)))
343 ;; If there is nothing to loop over, then inherit from the
344 ;; default superclass.
345 (unless (eq cname 'eieio-default-superclass)
346 ;; adopt the default parent here, but clear it later...
347 (setq clearparent t)
348 ;; save new child in parent
349 (cl-pushnew cname (eieio--class-children eieio-default-superclass))
350 ;; save parent in child
351 (setf (eieio--class-parents newc) (list eieio-default-superclass))))
352
353 ;; turn this into a usable self-pointing symbol; FIXME: Why?
354 (when eieio-backward-compatibility
355 (set cname cname)
356 (make-obsolete-variable cname (format "use '%s instead" cname) "25.1"))
357
358 ;; Create a handy list of the class test too
359 (when eieio-backward-compatibility
360 (let ((csym (intern (concat (symbol-name cname) "-list-p"))))
361 (defalias csym
362 `(lambda (obj)
363 ,(format
364 "Test OBJ to see if it a list of objects which are a child of type %s"
365 cname)
366 (when (listp obj)
367 (let ((ans t)) ;; nil is valid
368 ;; Loop over all the elements of the input list, test
369 ;; each to make sure it is a child of the desired object class.
370 (while (and obj ans)
371 (setq ans (and (eieio-object-p (car obj))
372 (object-of-class-p (car obj) ,cname)))
373 (setq obj (cdr obj)))
374 ans))))
375 (make-obsolete csym (format "use (cl-typep ... '(list-of %s)) instead"
376 cname)
377 "25.1")))
378
379 ;; Before adding new slots, let's add all the methods and classes
380 ;; in from the parent class.
381 (eieio-copy-parents-into-subclass newc)
382
383 ;; Store the new class vector definition into the symbol. We need to
384 ;; do this first so that we can call defmethod for the accessor.
385 ;; The vector will be updated by the following while loop and will not
386 ;; need to be stored a second time.
387 (setf (eieio--class-v cname) newc)
388
389 ;; Query each slot in the declaration list and mangle into the
390 ;; class structure I have defined.
391 (pcase-dolist (`(,name . ,slot) slots)
392 (let* ((init (or (plist-get slot :initform)
393 (if (member :initform slot) nil
394 eieio-unbound)))
395 (initarg (plist-get slot :initarg))
396 (docstr (plist-get slot :documentation))
397 (prot (plist-get slot :protection))
398 (alloc (plist-get slot :allocation))
399 (type (plist-get slot :type))
400 (custom (plist-get slot :custom))
401 (label (plist-get slot :label))
402 (customg (plist-get slot :group))
403 (printer (plist-get slot :printer))
404
405 (skip-nil (eieio--class-option-assoc options :allow-nil-initform))
406 )
407
408 ;; Clean up the meaning of protection.
409 (setq prot
410 (pcase prot
411 ((or 'nil 'public ':public) nil)
412 ((or 'protected ':protected) 'protected)
413 ((or 'private ':private) 'private)
414 (_ (signal 'invalid-slot-type (list :protection prot)))))
415
416 ;; The default type specifier is supposed to be t, meaning anything.
417 (if (not type) (setq type t))
418
419 ;; intern the symbol so we can use it blankly
420 (if eieio-backward-compatibility
421 (and initarg (not (keywordp initarg))
422 (progn
423 (set initarg initarg)
424 (make-obsolete-variable
425 initarg (format "use '%s instead" initarg) "25.1"))))
426
427 ;; The customgroup should be a list of symbols.
428 (cond ((and (null customg) custom)
429 (setq customg '(default)))
430 ((not (listp customg))
431 (setq customg (list customg))))
432 ;; The customgroup better be a list of symbols.
433 (dolist (cg customg)
434 (unless (symbolp cg)
435 (signal 'invalid-slot-type (list :group cg))))
436
437 ;; First up, add this slot into our new class.
438 (eieio--add-new-slot
439 newc (cl--make-slot-descriptor
440 name init type
441 `(,@(if docstr `((:documentation . ,docstr)))
442 ,@(if custom `((:custom . ,custom)))
443 ,@(if label `((:label . ,label)))
444 ,@(if customg `((:group . ,customg)))
445 ,@(if printer `((:printer . ,printer)))
446 ,@(if prot `((:protection . ,prot)))))
447 initarg alloc 'defaultoverride skip-nil)
448
449 ;; We need to id the group, and store them in a group list attribute.
450 (dolist (cg customg)
451 (cl-pushnew cg groups :test #'equal))
452 ))
453
454 ;; Now that everything has been loaded up, all our lists are backwards!
455 ;; Fix that up now and then them into vectors.
456 (cl-callf (lambda (slots) (apply #'vector (nreverse slots)))
457 (eieio--class-slots newc))
458 (cl-callf nreverse (eieio--class-initarg-tuples newc))
459
460 ;; The storage for class-class-allocation-type needs to be turned into
461 ;; a vector now.
462 (cl-callf (lambda (slots) (apply #'vector slots))
463 (eieio--class-class-slots newc))
464
465 ;; Also, setup the class allocated values.
466 (let* ((slots (eieio--class-class-slots newc))
467 (n (length slots))
468 (v (make-vector n nil)))
469 (dotimes (i n)
470 (setf (aref v i) (eieio-default-eval-maybe
471 (cl--slot-descriptor-initform (aref slots i)))))
472 (setf (eieio--class-class-allocation-values newc) v))
473
474 ;; Attach slot symbols into a hashtable, and store the index of
475 ;; this slot as the value this table.
476 (let* ((slots (eieio--class-slots newc))
477 ;; (cslots (eieio--class-class-slots newc))
478 (oa (make-hash-table :test #'eq)))
479 ;; (dotimes (cnt (length cslots))
480 ;; (setf (gethash (cl--slot-descriptor-name (aref cslots cnt)) oa) (- -1 cnt)))
481 (dotimes (cnt (length slots))
482 (setf (gethash (cl--slot-descriptor-name (aref slots cnt)) oa) cnt))
483 (setf (eieio--class-index-table newc) oa))
484
485 ;; Set up a specialized doc string.
486 ;; Use stored value since it is calculated in a non-trivial way
487 (let ((docstring (eieio--class-option-assoc options :documentation)))
488 (setf (eieio--class-docstring newc) docstring)
489 (when eieio-backward-compatibility
490 (put cname 'variable-documentation docstring)))
491
492 ;; Save the file location where this class is defined.
493 (add-to-list 'current-load-list `(eieio-defclass . ,cname))
494
495 ;; We have a list of custom groups. Store them into the options.
496 (let ((g (eieio--class-option-assoc options :custom-groups)))
497 (mapc (lambda (cg) (cl-pushnew cg g :test 'equal)) groups)
498 (if (memq :custom-groups options)
499 (setcar (cdr (memq :custom-groups options)) g)
500 (setq options (cons :custom-groups (cons g options)))))
501
502 ;; Set up the options we have collected.
503 (setf (eieio--class-options newc) options)
504
505 ;; if this is a superclass, clear out parent (which was set to the
506 ;; default superclass eieio-default-superclass)
507 (if clearparent (setf (eieio--class-parents newc) nil))
508
509 ;; Create the cached default object.
510 (let ((cache (make-vector (+ (length (eieio--class-slots newc))
511 (eval-when-compile eieio--object-num-slots))
512 nil))
513 ;; We don't strictly speaking need to use a symbol, but the old
514 ;; code used the class's name rather than the class's object, so
515 ;; we follow this preference for using a symbol, which is probably
516 ;; convenient to keep the printed representation of such Elisp
517 ;; objects readable.
518 (tag (intern (format "eieio-class-tag--%s" cname))))
519 (set tag newc)
520 (fset tag :quick-object-witness-check)
521 (setf (eieio--object-class-tag cache) tag)
522 (let ((eieio-skip-typecheck t))
523 ;; All type-checking has been done to our satisfaction
524 ;; before this call. Don't waste our time in this call..
525 (eieio-set-defaults cache t))
526 (setf (eieio--class-default-object-cache newc) cache))
527
528 ;; Return our new class object
529 ;; newc
530 cname
531 ))
532
533 (defsubst eieio-eval-default-p (val)
534 "Whether the default value VAL should be evaluated for use."
535 (and (consp val) (symbolp (car val)) (fboundp (car val))))
536
537 (defun eieio--perform-slot-validation-for-default (slot skipnil)
538 "For SLOT, signal if its type does not match its default value.
539 If SKIPNIL is non-nil, then if default value is nil return t instead."
540 (let ((value (cl--slot-descriptor-initform slot))
541 (spec (cl--slot-descriptor-type slot)))
542 (if (not (or (eieio-eval-default-p value) ;FIXME: Why?
543 eieio-skip-typecheck
544 (and skipnil (null value))
545 (eieio--perform-slot-validation spec value)))
546 (signal 'invalid-slot-type (list (cl--slot-descriptor-name slot) spec value)))))
547
548 (defun eieio--slot-override (old new skipnil)
549 (cl-assert (eq (cl--slot-descriptor-name old) (cl--slot-descriptor-name new)))
550 ;; There is a match, and we must override the old value.
551 (let* ((a (cl--slot-descriptor-name old))
552 (tp (cl--slot-descriptor-type old))
553 (d (cl--slot-descriptor-initform new))
554 (type (cl--slot-descriptor-type new))
555 (oprops (cl--slot-descriptor-props old))
556 (nprops (cl--slot-descriptor-props new))
557 (custg (alist-get :group nprops)))
558 ;; If type is passed in, is it the same?
559 (if (not (eq type t))
560 (if (not (equal type tp))
561 (error
562 "Child slot type `%s' does not match inherited type `%s' for `%s'"
563 type tp a))
564 (setf (cl--slot-descriptor-type new) tp))
565 ;; If we have a repeat, only update the initarg...
566 (unless (eq d eieio-unbound)
567 (eieio--perform-slot-validation-for-default new skipnil)
568 (setf (cl--slot-descriptor-initform old) d))
569
570 ;; PLN Tue Jun 26 11:57:06 2007 : The protection is
571 ;; checked and SHOULD match the superclass
572 ;; protection. Otherwise an error is thrown. However
573 ;; I wonder if a more flexible schedule might be
574 ;; implemented.
575 ;;
576 ;; EML - We used to have (if prot... here,
577 ;; but a prot of 'nil means public.
578 ;;
579 (let ((super-prot (alist-get :protection oprops))
580 (prot (alist-get :protection nprops)))
581 (if (not (eq prot super-prot))
582 (error "Child slot protection `%s' does not match inherited protection `%s' for `%s'"
583 prot super-prot a)))
584 ;; End original PLN
585
586 ;; PLN Tue Jun 26 11:57:06 2007 :
587 ;; Do a non redundant combination of ancient custom
588 ;; groups and new ones.
589 (when custg
590 (let* ((list1 (alist-get :group oprops)))
591 (dolist (elt custg)
592 (unless (memq elt list1)
593 (push elt list1)))
594 (setf (alist-get :group (cl--slot-descriptor-props old)) list1)))
595 ;; End PLN
596
597 ;; PLN Mon Jun 25 22:44:34 2007 : If a new cust is
598 ;; set, simply replaces the old one.
599 (dolist (prop '(:custom :label :documentation :printer))
600 (when (alist-get prop (cl--slot-descriptor-props new))
601 (setf (alist-get prop (cl--slot-descriptor-props old))
602 (alist-get prop (cl--slot-descriptor-props new))))
603
604 ) ))
605
606 (defun eieio--add-new-slot (newc slot init alloc
607 &optional defaultoverride skipnil)
608 "Add into NEWC attribute SLOT.
609 If a slot of that name already exists in NEWC, then do nothing. If it doesn't exist,
610 INIT is the initarg, if any.
611 Argument ALLOC specifies if the slot is allocated per instance, or per class.
612 If optional DEFAULTOVERRIDE is non-nil, then if A exists in NEWC,
613 we must override its value for a default.
614 Optional argument SKIPNIL indicates if type checking should be skipped
615 if default value is nil."
616 ;; Make sure we duplicate those items that are sequences.
617 (let* ((a (cl--slot-descriptor-name slot))
618 (d (cl--slot-descriptor-initform slot))
619 (old (car (cl-member a (eieio--class-slots newc)
620 :key #'cl--slot-descriptor-name)))
621 (cold (car (cl-member a (eieio--class-class-slots newc)
622 :key #'cl--slot-descriptor-name))))
623 (condition-case nil
624 (if (sequencep d) (setq d (copy-sequence d)))
625 ;; This copy can fail on a cons cell with a non-cons in the cdr. Let's
626 ;; skip it if it doesn't work.
627 (error nil))
628 ;; (if (sequencep type) (setq type (copy-sequence type)))
629 ;; (if (sequencep cust) (setq cust (copy-sequence cust)))
630 ;; (if (sequencep custg) (setq custg (copy-sequence custg)))
631
632 ;; To prevent override information w/out specification of storage,
633 ;; we need to do this little hack.
634 (if cold (setq alloc :class))
635
636 (if (memq alloc '(nil :instance))
637 ;; In this case, we modify the INSTANCE version of a given slot.
638 (progn
639 ;; Only add this element if it is so-far unique
640 (if (not old)
641 (progn
642 (eieio--perform-slot-validation-for-default slot skipnil)
643 (push slot (eieio--class-slots newc))
644 )
645 ;; When defaultoverride is true, we are usually adding new local
646 ;; attributes which must override the default value of any slot
647 ;; passed in by one of the parent classes.
648 (when defaultoverride
649 (eieio--slot-override old slot skipnil)))
650 (when init
651 (cl-pushnew (cons init a) (eieio--class-initarg-tuples newc)
652 :test #'equal)))
653
654 ;; CLASS ALLOCATED SLOTS
655 (if (not cold)
656 (progn
657 (eieio--perform-slot-validation-for-default slot skipnil)
658 ;; Here we have found a :class version of a slot. This
659 ;; requires a very different approach.
660 (push slot (eieio--class-class-slots newc)))
661 (when defaultoverride
662 ;; There is a match, and we must override the old value.
663 (eieio--slot-override cold slot skipnil))))))
664
665 (defun eieio-copy-parents-into-subclass (newc)
666 "Copy into NEWC the slots of PARENTS.
667 Follow the rules of not overwriting early parents when applying to
668 the new child class."
669 (let ((sn (eieio--class-option-assoc (eieio--class-options newc)
670 :allow-nil-initform)))
671 (dolist (pcv (eieio--class-parents newc))
672 ;; First, duplicate all the slots of the parent.
673 (let ((pslots (eieio--class-slots pcv))
674 (pinit (eieio--class-initarg-tuples pcv)))
675 (dotimes (i (length pslots))
676 (let* ((sd (cl--copy-slot-descriptor (aref pslots i)))
677 (init (car (rassq (cl--slot-descriptor-name sd) pinit))))
678 (eieio--add-new-slot newc sd init nil nil sn))
679 )) ;; while/let
680 ;; Now duplicate all the class alloc slots.
681 (let ((pcslots (eieio--class-class-slots pcv)))
682 (dotimes (i (length pcslots))
683 (eieio--add-new-slot newc (cl--copy-slot-descriptor
684 (aref pcslots i))
685 nil :class sn)
686 )))))
687
688 \f
689 ;;; Slot type validation
690
691 ;; This is a hideous hack for replacing `typep' from cl-macs, to avoid
692 ;; requiring the CL library at run-time. It can be eliminated if/when
693 ;; `typep' is merged into Emacs core.
694
695 (defun eieio--perform-slot-validation (spec value)
696 "Return non-nil if SPEC does not match VALUE."
697 (or (eq spec t) ; t always passes
698 (eq value eieio-unbound) ; unbound always passes
699 (cl-typep value spec)))
700
701 (defun eieio--validate-slot-value (class slot-idx value slot)
702 "Make sure that for CLASS referencing SLOT-IDX, VALUE is valid.
703 Checks the :type specifier.
704 SLOT is the slot that is being checked, and is only used when throwing
705 an error."
706 (if eieio-skip-typecheck
707 nil
708 ;; Trim off object IDX junk added in for the object index.
709 (setq slot-idx (- slot-idx (eval-when-compile eieio--object-num-slots)))
710 (let ((st (cl--slot-descriptor-type (aref (eieio--class-slots class)
711 slot-idx))))
712 (if (not (eieio--perform-slot-validation st value))
713 (signal 'invalid-slot-type
714 (list (eieio--class-name class) slot st value))))))
715
716 (defun eieio--validate-class-slot-value (class slot-idx value slot)
717 "Make sure that for CLASS referencing SLOT-IDX, VALUE is valid.
718 Checks the :type specifier.
719 SLOT is the slot that is being checked, and is only used when throwing
720 an error."
721 (if eieio-skip-typecheck
722 nil
723 (let ((st (cl--slot-descriptor-type (aref (eieio--class-class-slots class)
724 slot-idx))))
725 (if (not (eieio--perform-slot-validation st value))
726 (signal 'invalid-slot-type
727 (list (eieio--class-name class) slot st value))))))
728
729 (defun eieio-barf-if-slot-unbound (value instance slotname fn)
730 "Throw a signal if VALUE is a representation of an UNBOUND slot.
731 INSTANCE is the object being referenced. SLOTNAME is the offending
732 slot. If the slot is ok, return VALUE.
733 Argument FN is the function calling this verifier."
734 (if (and (eq value eieio-unbound) (not eieio-skip-typecheck))
735 (slot-unbound instance (eieio--object-class instance) slotname fn)
736 value))
737
738 \f
739 ;;; Get/Set slots in an object.
740 ;;
741 (defun eieio-oref (obj slot)
742 "Return the value in OBJ at SLOT in the object vector."
743 (cl-check-type slot symbol)
744 (cl-check-type obj (or eieio-object class))
745 (let* ((class (cond ((symbolp obj)
746 (error "eieio-oref called on a class!")
747 (let ((c (eieio--class-v obj)))
748 (if (eieio--class-p c) (eieio-class-un-autoload obj))
749 c))
750 (t (eieio--object-class obj))))
751 (c (eieio--slot-name-index class slot)))
752 (if (not c)
753 ;; It might be missing because it is a :class allocated slot.
754 ;; Let's check that info out.
755 (if (setq c (eieio--class-slot-name-index class slot))
756 ;; Oref that slot.
757 (aref (eieio--class-class-allocation-values class) c)
758 ;; The slot-missing method is a cool way of allowing an object author
759 ;; to intercept missing slot definitions. Since it is also the LAST
760 ;; thing called in this fn, its return value would be retrieved.
761 (slot-missing obj slot 'oref)
762 ;;(signal 'invalid-slot-name (list (eieio-object-name obj) slot))
763 )
764 (cl-check-type obj eieio-object)
765 (eieio-barf-if-slot-unbound (aref obj c) obj slot 'oref))))
766
767
768 (defun eieio-oref-default (obj slot)
769 "Do the work for the macro `oref-default' with similar parameters.
770 Fills in OBJ's SLOT with its default value."
771 (cl-check-type obj (or eieio-object class))
772 (cl-check-type slot symbol)
773 (let* ((cl (cond ((symbolp obj) (eieio--class-v obj))
774 (t (eieio--object-class obj))))
775 (c (eieio--slot-name-index cl slot)))
776 (if (not c)
777 ;; It might be missing because it is a :class allocated slot.
778 ;; Let's check that info out.
779 (if (setq c
780 (eieio--class-slot-name-index cl slot))
781 ;; Oref that slot.
782 (aref (eieio--class-class-allocation-values cl)
783 c)
784 (slot-missing obj slot 'oref-default)
785 ;;(signal 'invalid-slot-name (list (class-name cl) slot))
786 )
787 (eieio-barf-if-slot-unbound
788 (let ((val (cl--slot-descriptor-initform
789 (aref (eieio--class-slots cl)
790 (- c (eval-when-compile eieio--object-num-slots))))))
791 (eieio-default-eval-maybe val))
792 obj (eieio--class-name cl) 'oref-default))))
793
794 (defun eieio-default-eval-maybe (val)
795 "Check VAL, and return what `oref-default' would provide."
796 ;; FIXME: What the hell is this supposed to do? Shouldn't it evaluate
797 ;; variables as well? Why not just always call `eval'?
798 (cond
799 ;; Is it a function call? If so, evaluate it.
800 ((eieio-eval-default-p val)
801 (eval val))
802 ;;;; check for quoted things, and unquote them
803 ;;((and (consp val) (eq (car val) 'quote))
804 ;; (car (cdr val)))
805 ;; return it verbatim
806 (t val)))
807
808 (defun eieio-oset (obj slot value)
809 "Do the work for the macro `oset'.
810 Fills in OBJ's SLOT with VALUE."
811 (cl-check-type obj eieio-object)
812 (cl-check-type slot symbol)
813 (let* ((class (eieio--object-class obj))
814 (c (eieio--slot-name-index class slot)))
815 (if (not c)
816 ;; It might be missing because it is a :class allocated slot.
817 ;; Let's check that info out.
818 (if (setq c
819 (eieio--class-slot-name-index class slot))
820 ;; Oset that slot.
821 (progn
822 (eieio--validate-class-slot-value class c value slot)
823 (aset (eieio--class-class-allocation-values class)
824 c value))
825 ;; See oref for comment on `slot-missing'
826 (slot-missing obj slot 'oset value)
827 ;;(signal 'invalid-slot-name (list (eieio-object-name obj) slot))
828 )
829 (eieio--validate-slot-value class c value slot)
830 (aset obj c value))))
831
832 (defun eieio-oset-default (class slot value)
833 "Do the work for the macro `oset-default'.
834 Fills in the default value in CLASS' in SLOT with VALUE."
835 (setq class (eieio--class-object class))
836 (cl-check-type class eieio--class)
837 (cl-check-type slot symbol)
838 (let* ((c (eieio--slot-name-index class slot)))
839 (if (not c)
840 ;; It might be missing because it is a :class allocated slot.
841 ;; Let's check that info out.
842 (if (setq c (eieio--class-slot-name-index class slot))
843 (progn
844 ;; Oref that slot.
845 (eieio--validate-class-slot-value class c value slot)
846 (aset (eieio--class-class-allocation-values class) c
847 value))
848 (signal 'invalid-slot-name (list (eieio--class-name class) slot)))
849 ;; `oset-default' on an instance-allocated slot is allowed by EIEIO but
850 ;; not by CLOS and is mildly inconsistent with the :initform thingy, so
851 ;; it'd be nice to get of it. This said, it is/was used at one place by
852 ;; gnus/registry.el, so it might be used elsewhere as well, so let's
853 ;; keep it for now.
854 ;; FIXME: Generate a compile-time warning for it!
855 ;; (error "Can't `oset-default' an instance-allocated slot: %S of %S"
856 ;; slot class)
857 (eieio--validate-slot-value class c value slot)
858 ;; Set this into the storage for defaults.
859 (if (eieio-eval-default-p value)
860 (error "Can't set default to a sexp that gets evaluated again"))
861 (setf (cl--slot-descriptor-initform
862 ;; FIXME: Apparently we set it both in `slots' and in
863 ;; `object-cache', which seems redundant.
864 (aref (eieio--class-slots class)
865 (- c (eval-when-compile eieio--object-num-slots))))
866 value)
867 ;; Take the value, and put it into our cache object.
868 (eieio-oset (eieio--class-default-object-cache class)
869 slot value)
870 )))
871
872 \f
873 ;;; EIEIO internal search functions
874 ;;
875 (defun eieio--slot-name-index (class slot)
876 "In CLASS find the index of the named SLOT.
877 The slot is a symbol which is installed in CLASS by the `defclass' call.
878 If SLOT is the value created with :initarg instead,
879 reverse-lookup that name, and recurse with the associated slot value."
880 ;; Removed checks to outside this call
881 (let* ((fsi (gethash slot (eieio--class-index-table class))))
882 (if (integerp fsi)
883 (+ (eval-when-compile eieio--object-num-slots) fsi)
884 (let ((fn (eieio--initarg-to-attribute class slot)))
885 (if fn
886 ;; Accessing a slot via its :initarg is accepted by EIEIO
887 ;; (but not CLOS) but is a bad idea (for one: it's slower).
888 ;; FIXME: We should emit a compile-time warning when this happens!
889 (eieio--slot-name-index class fn)
890 nil)))))
891
892 (defun eieio--class-slot-name-index (class slot)
893 "In CLASS find the index of the named SLOT.
894 The slot is a symbol which is installed in CLASS by the `defclass'
895 call. If SLOT is the value created with :initarg instead,
896 reverse-lookup that name, and recurse with the associated slot value."
897 ;; This will happen less often, and with fewer slots. Do this the
898 ;; storage cheap way.
899 (let ((index nil)
900 (slots (eieio--class-class-slots class)))
901 (dotimes (i (length slots))
902 (if (eq slot (cl--slot-descriptor-name (aref slots i)))
903 (setq index i)))
904 index))
905
906 ;;;
907 ;; Way to assign slots based on a list. Used for constructors, or
908 ;; even resetting an object at run-time
909 ;;
910 (defun eieio-set-defaults (obj &optional set-all)
911 "Take object OBJ, and reset all slots to their defaults.
912 If SET-ALL is non-nil, then when a default is nil, that value is
913 reset. If SET-ALL is nil, the slots are only reset if the default is
914 not nil."
915 (let ((slots (eieio--class-slots (eieio--object-class obj))))
916 (dotimes (i (length slots))
917 (let* ((name (cl--slot-descriptor-name (aref slots i)))
918 (df (eieio-oref-default obj name)))
919 (if (or df set-all)
920 (eieio-oset obj name df))))))
921
922 (defun eieio--initarg-to-attribute (class initarg)
923 "For CLASS, convert INITARG to the actual attribute name.
924 If there is no translation, pass it in directly (so we can cheat if
925 need be... May remove that later...)"
926 (let ((tuple (assoc initarg (eieio--class-initarg-tuples class))))
927 (if tuple
928 (cdr tuple)
929 nil)))
930
931 ;;;
932 ;; Method Invocation order: C3
933 (defun eieio--c3-candidate (class remaining-inputs)
934 "Return CLASS if it can go in the result now, otherwise nil."
935 ;; Ensure CLASS is not in any position but the first in any of the
936 ;; element lists of REMAINING-INPUTS.
937 (and (not (let ((found nil))
938 (while (and remaining-inputs (not found))
939 (setq found (member class (cdr (car remaining-inputs)))
940 remaining-inputs (cdr remaining-inputs)))
941 found))
942 class))
943
944 (defun eieio--c3-merge-lists (reversed-partial-result remaining-inputs)
945 "Merge REVERSED-PARTIAL-RESULT REMAINING-INPUTS in a consistent order, if possible.
946 If a consistent order does not exist, signal an error."
947 (setq remaining-inputs (delq nil remaining-inputs))
948 (if (null remaining-inputs)
949 ;; If all remaining inputs are empty lists, we are done.
950 (nreverse reversed-partial-result)
951 ;; Otherwise, we try to find the next element of the result. This
952 ;; is achieved by considering the first element of each
953 ;; (non-empty) input list and accepting a candidate if it is
954 ;; consistent with the rests of the input lists.
955 (let* ((found nil)
956 (tail remaining-inputs)
957 (next (progn
958 (while (and tail (not found))
959 (setq found (eieio--c3-candidate (caar tail)
960 remaining-inputs)
961 tail (cdr tail)))
962 found)))
963 (if next
964 ;; The graph is consistent so far, add NEXT to result and
965 ;; merge input lists, dropping NEXT from their heads where
966 ;; applicable.
967 (eieio--c3-merge-lists
968 (cons next reversed-partial-result)
969 (mapcar (lambda (l) (if (eq (cl-first l) next) (cl-rest l) l))
970 remaining-inputs))
971 ;; The graph is inconsistent, give up
972 (signal 'inconsistent-class-hierarchy (list remaining-inputs))))))
973
974 (defsubst eieio--class/struct-parents (class)
975 (or (eieio--class-parents class)
976 `(,eieio-default-superclass)))
977
978 (defun eieio--class-precedence-c3 (class)
979 "Return all parents of CLASS in c3 order."
980 (let ((parents (eieio--class-parents (eieio--class-v class))))
981 (eieio--c3-merge-lists
982 (list class)
983 (append
984 (or
985 (mapcar #'eieio--class-precedence-c3 parents)
986 `((,eieio-default-superclass)))
987 (list parents))))
988 )
989 ;;;
990 ;; Method Invocation Order: Depth First
991
992 (defun eieio--class-precedence-dfs (class)
993 "Return all parents of CLASS in depth-first order."
994 (let* ((parents (eieio--class-parents class))
995 (classes (copy-sequence
996 (apply #'append
997 (list class)
998 (or
999 (mapcar
1000 (lambda (parent)
1001 (cons parent
1002 (eieio--class-precedence-dfs parent)))
1003 parents)
1004 `((,eieio-default-superclass))))))
1005 (tail classes))
1006 ;; Remove duplicates.
1007 (while tail
1008 (setcdr tail (delq (car tail) (cdr tail)))
1009 (setq tail (cdr tail)))
1010 classes))
1011
1012 ;;;
1013 ;; Method Invocation Order: Breadth First
1014 (defun eieio--class-precedence-bfs (class)
1015 "Return all parents of CLASS in breadth-first order."
1016 (let* ((result)
1017 (queue (eieio--class/struct-parents class)))
1018 (while queue
1019 (let ((head (pop queue)))
1020 (unless (member head result)
1021 (push head result)
1022 (unless (eq head eieio-default-superclass)
1023 (setq queue (append queue (eieio--class/struct-parents head)))))))
1024 (cons class (nreverse result)))
1025 )
1026
1027 ;;;
1028 ;; Method Invocation Order
1029
1030 (defun eieio--class-precedence-list (class)
1031 "Return (transitively closed) list of parents of CLASS.
1032 The order, in which the parents are returned depends on the
1033 method invocation orders of the involved classes."
1034 (if (or (null class) (eq class eieio-default-superclass))
1035 nil
1036 (unless (eieio--class-default-object-cache class)
1037 (eieio-class-un-autoload (eieio--class-name class)))
1038 (cl-case (eieio--class-method-invocation-order class)
1039 (:depth-first
1040 (eieio--class-precedence-dfs class))
1041 (:breadth-first
1042 (eieio--class-precedence-bfs class))
1043 (:c3
1044 (eieio--class-precedence-c3 class))))
1045 )
1046 (define-obsolete-function-alias
1047 'class-precedence-list 'eieio--class-precedence-list "24.4")
1048
1049 \f
1050 ;;; Here are some special types of errors
1051 ;;
1052 (define-error 'invalid-slot-name "Invalid slot name")
1053 (define-error 'invalid-slot-type "Invalid slot type")
1054 (define-error 'unbound-slot "Unbound slot")
1055 (define-error 'inconsistent-class-hierarchy "Inconsistent class hierarchy")
1056
1057 ;;; Hooking into cl-generic.
1058
1059 (require 'cl-generic)
1060
1061 ;;;; General support to dispatch based on the type of the argument.
1062
1063 (defconst eieio--generic-generalizer
1064 (cl-generic-make-generalizer
1065 ;; Use the exact same tagcode as for cl-struct, so that methods
1066 ;; that dispatch on both kinds of objects get to share this
1067 ;; part of the dispatch code.
1068 50 #'cl--generic-struct-tag
1069 (lambda (tag)
1070 (and (symbolp tag) (boundp tag) (eieio--class-p (symbol-value tag))
1071 (mapcar #'eieio--class-name
1072 (eieio--class-precedence-list (symbol-value tag)))))))
1073
1074 (cl-defmethod cl-generic-generalizers :extra "class" (specializer)
1075 ;; CLHS says:
1076 ;; A class must be defined before it can be used as a parameter
1077 ;; specializer in a defmethod form.
1078 ;; So we can ignore types that are not known to denote classes.
1079 (or
1080 (and (eieio--class-p (eieio--class-object specializer))
1081 (list eieio--generic-generalizer))
1082 (cl-call-next-method)))
1083
1084 ;;;; Dispatch for arguments which are classes.
1085
1086 ;; Since EIEIO does not support metaclasses, users can't easily use the
1087 ;; "dispatch on argument type" for class arguments. That's why EIEIO's
1088 ;; `defmethod' added the :static qualifier. For cl-generic, such a qualifier
1089 ;; would not make much sense (e.g. to which argument should it apply?).
1090 ;; Instead, we add a new "subclass" specializer.
1091
1092 (defun eieio--generic-subclass-specializers (tag)
1093 (when (eieio--class-p tag)
1094 (mapcar (lambda (class)
1095 `(subclass ,(eieio--class-name class)))
1096 (eieio--class-precedence-list tag))))
1097
1098 (defconst eieio--generic-subclass-generalizer
1099 (cl-generic-make-generalizer
1100 60 (lambda (name) `(and (symbolp ,name) (eieio--class-v ,name)))
1101 #'eieio--generic-subclass-specializers))
1102
1103 (cl-defmethod cl-generic-generalizers ((_specializer (head subclass)))
1104 (list eieio--generic-subclass-generalizer))
1105
1106 \f
1107 ;;;### (autoloads nil "eieio-compat" "eieio-compat.el" "0609a7bdcd6f38876b7f5647047ddca9")
1108 ;;; Generated autoloads from eieio-compat.el
1109
1110 (autoload 'eieio--defalias "eieio-compat" "\
1111 Like `defalias', but with less side-effects.
1112 More specifically, it has no side-effects at all when the new function
1113 definition is the same (`eq') as the old one.
1114
1115 \(fn NAME BODY)" nil nil)
1116
1117 (autoload 'defgeneric "eieio-compat" "\
1118 Create a generic function METHOD.
1119 DOC-STRING is the base documentation for this class. A generic
1120 function has no body, as its purpose is to decide which method body
1121 is appropriate to use. Uses `defmethod' to create methods, and calls
1122 `defgeneric' for you. With this implementation the ARGS are
1123 currently ignored. You can use `defgeneric' to apply specialized
1124 top level documentation to a method.
1125
1126 \(fn METHOD ARGS &optional DOC-STRING)" nil t)
1127
1128 (function-put 'defgeneric 'doc-string-elt '3)
1129
1130 (make-obsolete 'defgeneric 'cl-defgeneric '"25.1")
1131
1132 (autoload 'defmethod "eieio-compat" "\
1133 Create a new METHOD through `defgeneric' with ARGS.
1134
1135 The optional second argument KEY is a specifier that
1136 modifies how the method is called, including:
1137 :before - Method will be called before the :primary
1138 :primary - The default if not specified
1139 :after - Method will be called after the :primary
1140 :static - First arg could be an object or class
1141 The next argument is the ARGLIST. The ARGLIST specifies the arguments
1142 to the method as with `defun'. The first argument can have a type
1143 specifier, such as:
1144 ((VARNAME CLASS) ARG2 ...)
1145 where VARNAME is the name of the local variable for the method being
1146 created. The CLASS is a class symbol for a class made with `defclass'.
1147 A DOCSTRING comes after the ARGLIST, and is optional.
1148 All the rest of the args are the BODY of the method. A method will
1149 return the value of the last form in the BODY.
1150
1151 Summary:
1152
1153 (defmethod mymethod [:before | :primary | :after | :static]
1154 ((typearg class-name) arg2 &optional opt &rest rest)
1155 \"doc-string\"
1156 body)
1157
1158 \(fn METHOD &rest ARGS)" nil t)
1159
1160 (function-put 'defmethod 'doc-string-elt '3)
1161
1162 (make-obsolete 'defmethod 'cl-defmethod '"25.1")
1163
1164 (autoload 'eieio--defgeneric-init-form "eieio-compat" "\
1165
1166
1167 \(fn METHOD DOC-STRING)" nil nil)
1168
1169 (autoload 'eieio--defmethod "eieio-compat" "\
1170
1171
1172 \(fn METHOD KIND ARGCLASS CODE)" nil nil)
1173
1174 (autoload 'eieio-defmethod "eieio-compat" "\
1175 Obsolete work part of an old version of the `defmethod' macro.
1176
1177 \(fn METHOD ARGS)" nil nil)
1178
1179 (make-obsolete 'eieio-defmethod 'cl-defmethod '"24.1")
1180
1181 (autoload 'eieio-defgeneric "eieio-compat" "\
1182 Obsolete work part of an old version of the `defgeneric' macro.
1183
1184 \(fn METHOD DOC-STRING)" nil nil)
1185
1186 (make-obsolete 'eieio-defgeneric 'cl-defgeneric '"24.1")
1187
1188 (autoload 'eieio-defclass "eieio-compat" "\
1189
1190
1191 \(fn CNAME SUPERCLASSES SLOTS OPTIONS)" nil nil)
1192
1193 (make-obsolete 'eieio-defclass 'eieio-defclass-internal '"25.1")
1194
1195 ;;;***
1196 \f
1197
1198 (provide 'eieio-core)
1199
1200 ;;; eieio-core.el ends here