Function: eieio-oset
eieio-oset is a byte-compiled function defined in eieio-core.el.gz.
Signature
(eieio-oset OBJ SLOT VALUE)
Documentation
Do the work for the macro oset.
Fills in OBJ's SLOT with VALUE.
This function has :around advice: eieio-oset@closql-object.
Aliases
set-slot-value (obsolete since 25.1)
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/eieio-core.el.gz
(defun eieio-oset (obj slot value)
"Do the work for the macro `oset'.
Fills in OBJ's SLOT with VALUE."
(cl-check-type slot symbol)
(cond
((cl-typep obj '(or eieio-object cl-structure-object))
(let* ((class (eieio--object-class obj))
(c (eieio--slot-name-index class slot)))
(if (not c)
;; It might be missing because it is a :class allocated slot.
;; Let's check that info out.
(if (setq c
(eieio--class-slot-name-index class slot))
;; Oset that slot.
(progn
(eieio--validate-class-slot-value class c value slot)
(aset (eieio--class-class-allocation-values class)
c value))
;; See oref for comment on `slot-missing'
(slot-missing obj slot 'oset value))
(eieio--validate-slot-value class c value slot)
(aset obj c value))))
((cl-typep obj 'oclosure) (oclosure--set-slot-value obj slot value))
(t
(signal 'wrong-type-argument
(list '(or eieio-object cl-structure-object oclosure) obj)))))