Plaster
New
List
Login
common-lisp
default
anonymous
2022.02.13 18:58:13
(make-package 'test :use '(cl)) (in-package :test) (defclass auto-id-mixin () ((id :initarg :id :accessor id))) (defmethod initialize-instance ((object auto-id-mixin) &key) :after (setf (slot-value object 'id) (sxhash object)) (format t "~%object ~a created." object)) (defclass word (auto-id-mixin) ((text :initarg :text :accessor text))) (describe (make-instance 'word :text "lalala")) ;; object ‘#<WORD {1017FEBB93}>’ created. ;; #<WORD {1017FEBB93}> ;; [standard-object] ;; ;; Slots with :INSTANCE allocation: ;; ID = 3375613392891586029 ;; TEXT = #<unbound slot>
Raw
Annotate
Repaste
Edit