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.

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 obj eieio-object)
  (cl-check-type slot symbol)
  (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))))