(defcustom aria2-rcp-secret (or (let ((uuidgen (executable-find "uuidgen")))
(and uuidgen (string-trim (shell-command-to-string uuidgen))))
(sha1 (format "%s%s%s%s%s%s%s%s%s" (user-uid) (emacs-pid) (system-name)
(user-full-name) (current-time) (emacs-uptime) (buffer-string)
(random) (recent-keys))))
"Secret value used for authentication with the aria2c process, for use with --rpc-secret= switch."
:type '(integer :tag "Http port")
:group 'aria2)
....
(defclass aria2-controller (eieio-persistent)
((request-id :initarg :request-id
:initform 0
:type integer
:docstring "Value of id field in JSONRPC data, gets incremented for each request.")
(rcp-url :initarg :rcp-url
:initform (aria2--url)
:type string
:docstring "Url on which aria2c listens for JSON RPC requests.")
(secret :initarg :secret
:initform aria2-rcp-secret
:type string
:docstring "Secret value used for authentication with the aria2c process, for use with --rpc-secret= switch.")
(pid :initarg :pid
:initform -1
:type integer
:docstring "PID of the aria2c process, or -1 if process isn't running."))
:docstring "This takes care of starting/stopping aria2c process and provides methods for each remote command.")
Debugger entered--Lisp error: (invalid-slot-type secret string aria2-rcp-secret)
signal(invalid-slot-type (secret string aria2-rcp-secret))
eieio--perform-slot-validation-for-default(#s(cl-slot-descriptor :name secret :initform aria2-rcp-secret :type string :props nil) nil)
eieio--add-new-slot(#s(eieio--class :name aria2-controller :docstring nil :parents (#s(eieio--class :name eieio-persistent :docstring "This special class enables persistence through sav..." :parents nil :slots [#s(cl-slot-descriptor :name file :initform unbound :type string :props ((:documentation . "The save file for this persistent object.\nThis mus...")))] :index-table #<hash-table eq 1/65 0x155a11fa7855> :children (aria2-controller) :initarg-tuples ((:file . file)) :class-slots [#s(cl-slot-descriptor :name do-backups :initform t :type boolean :props ((:documentation . "Saving this object should make backup files.\nSetti..."))) #s(cl-slot-descriptor :name file-header-line :initform ";; EIEIO PERSISTENT OBJECT" :type string :props ((:documentation . "Header line for the save file.\nThis is used with t..."))) #s(cl-slot-descriptor :name extension :initform ".eieio" :type string :props ((:documentation . "Extension of files saved by this object.\nEnables a...")))] :class-allocation-values [t ";; EIEIO PERSISTENT OBJECT" ".eieio"] :default-object-cache #<eieio-persistent eieio-persistent-155a11ef7996> :options (:custom-groups nil :documentation "This special class enables persistence through sav..." :abstract t))) :slots (#s(cl-slot-descriptor :name rcp-url :initform (aria2--url) :type string :props nil) #s(cl-slot-descriptor :name request-id :initform 0 :type integer :props nil) #s(cl-slot-descriptor :name file :initform unbound :type string :props ((:documentation . "The save file for this persistent object.\nThis mus...")))) :index-table #<hash-table eq 5/65 0x155a182b9971> :children nil :initarg-tuples ((:rcp-url . rcp-url) (:request-id . request-id) (:file . file)) :class-slots (#s(cl-slot-descriptor :name extension :initform ".eieio" :type string :props ((:documentation . "Extension of files saved by this object.\nEnables a..."))) #s(cl-slot-descriptor :name file-header-line :initform ";; EIEIO PERSISTENT OBJECT" :type string :props ((:documentation . "Header line for the save file.\nThis is used with t..."))) #s(cl-slot-descriptor :name do-backups :initform t :type boolean :props ((:documentation . "Saving this object should make backup files.\nSetti...")))) :class-allocation-values [".eieio" ";; EIEIO PERSISTENT OBJECT" t] :default-object-cache #<aria2-controller aria2-controller-155a182b9bb6> :options (:custom-groups nil :docstring "This takes care of starting/stopping aria2c proces...")) #s(cl-slot-descriptor :name secret :initform aria2-rcp-secret :type string :props nil) :secret nil defaultoverride nil)
#f(compiled-function (cname superclasses slots options) "Define CNAME as a new subclass of SUPERCLASSES.\nSLOTS are the slots residing in that class definition, and OPTIONS\nholds the class options.\nSee `defclass' for more information." #<bytecode 0x1cff8c5a5ebb3174>)(aria2-controller (eieio-persistent) ((request-id :initarg :request-id :initform 0 :type integer :docstring "Value of id field in JSONRPC data, gets incremente...") (rcp-url :initarg :rcp-url :initform (aria2--url) :type string :docstring "Url on which aria2c listens for JSON RPC requests.") (secret :initarg :secret :initform aria2-rcp-secret :type string :docstring "Secret value used for authentication with the aria...") (pid :initarg :pid :initform -1 :type integer :docstring "PID of the aria2c process, or -1 if process isn't ...")) (:docstring "This takes care of starting/stopping aria2c proces..."))
apply(#f(compiled-function (cname superclasses slots options) "Define CNAME as a new subclass of SUPERCLASSES.\nSLOTS are the slots residing in that class definition, and OPTIONS\nholds the class options.\nSee `defclass' for more information." #<bytecode 0x1cff8c5a5ebb3174>) (aria2-controller (eieio-persistent) ((request-id :initarg :request-id :initform 0 :type integer :docstring "Value of id field in JSONRPC data, gets incremente...") (rcp-url :initarg :rcp-url :initform (aria2--url) :type string :docstring "Url on which aria2c listens for JSON RPC requests.") (secret :initarg :secret :initform aria2-rcp-secret :type string :docstring "Secret value used for authentication with the aria...") (pid :initarg :pid :initform -1 :type integer :docstring "PID of the aria2c process, or -1 if process isn't ...")) (:docstring "This takes care of starting/stopping aria2c proces...")))
eieio-defclass-internal(aria2-controller (eieio-persistent) ((request-id :initarg :request-id :initform 0 :type integer :docstring "Value of id field in JSONRPC data, gets incremente...") (rcp-url :initarg :rcp-url :initform (aria2--url) :type string :docstring "Url on which aria2c listens for JSON RPC requests.") (secret :initarg :secret :initform aria2-rcp-secret :type string :docstring "Secret value used for authentication with the aria...") (pid :initarg :pid :initform -1 :type integer :docstring "PID of the aria2c process, or -1 if process isn't ...")) (:docstring "This takes care of starting/stopping aria2c proces..."))
(progn (defalias 'aria2-controller-p (eieio-make-class-predicate 'aria2-controller)) (defalias 'aria2-controller--eieio-childp (eieio-make-child-predicate 'aria2-controller)) (defalias 'aria2-controller-child-p 'aria2-controller--eieio-childp) (make-obsolete 'aria2-controller-child-p "use (cl-typep ... \\='aria2-controller) instead" "25.1") (define-symbol-prop 'aria2-controller 'cl-deftype-satisfies #'aria2-controller--eieio-childp) (eieio-defclass-internal 'aria2-controller '(eieio-persistent) '((request-id :initarg :request-id :initform 0 :type integer :docstring "Value of id field in JSONRPC data, gets incremente...") (rcp-url :initarg :rcp-url :initform (aria2--url) :type string :docstring "Url on which aria2c listens for JSON RPC requests.") (secret :initarg :secret :initform aria2-rcp-secret :type string :docstring "Secret value used for authentication with the aria...") (pid :initarg :pid :initform -1 :type integer :docstring "PID of the aria2c process, or -1 if process isn't ...")) '(:docstring "This takes care of starting/stopping aria2c proces...")) (defun aria2-controller (&rest slots) "Create a new object of class type `aria2-controlle..." (declare (compiler-macro (lambda (whole) (if (not (stringp ...)) whole (macroexp--warn-and-return (format "Obsolete name arg %S to constructor %S" ... ...) `...))))) (apply #'make-instance 'aria2-controller slots)))
(defclass aria2-controller (eieio-persistent) ((request-id :initarg :request-id :initform 0 :type integer :docstring "Value of id field in JSONRPC data, gets incremente...") (rcp-url :initarg :rcp-url :initform (aria2--url) :type string :docstring "Url on which aria2c listens for JSON RPC requests.") (secret :initarg :secret :initform aria2-rcp-secret :type string :docstring "Secret value used for authentication with the aria...") (pid :initarg :pid :initform -1 :type integer :docstring "PID of the aria2c process, or -1 if process isn't ...")) :docstring "This takes care of starting/stopping aria2c proces...")
eval((defclass aria2-controller (eieio-persistent) ((request-id :initarg :request-id :initform 0 :type integer :docstring "Value of id field in JSONRPC data, gets incremente...") (rcp-url :initarg :rcp-url :initform (aria2--url) :type string :docstring "Url on which aria2c listens for JSON RPC requests.") (secret :initarg :secret :initform aria2-rcp-secret :type string :docstring "Secret value used for authentication with the aria...") (pid :initarg :pid :initform -1 :type integer :docstring "PID of the aria2c process, or -1 if process isn't ...")) :docstring "This takes care of starting/stopping aria2c proces...") nil)
edebug-eval-defun(nil)
apply(edebug-eval-defun nil)
eval-defun(nil)
eros-eval-defun(nil)
funcall-interactively(eros-eval-defun nil)
call-interactively(eros-eval-defun nil nil)
command-execute(eros-eval-defun)
(defun eieio--perform-slot-validation-for-default (slot skipnil)
"For SLOT, signal if its type does not match its default value.
If SKIPNIL is non-nil, then if default value is nil return t instead."
(let ((value (cl--slot-descriptor-initform slot))
(spec (cl--slot-descriptor-type slot)))
(if (not (or (eieio-eval-default-p value) ;FIXME: Why?
eieio-skip-typecheck
(and skipnil (null value))
(eieio--perform-slot-validation spec value)))
(signal 'invalid-slot-type (list (cl--slot-descriptor-name slot) spec value)))))
注意那一行注释 :FIXME: Why?,说明早就有人发现问题并且感到很懵逼了。
函数 eieio-eval-default-p 其实很简单,但是为啥不修复,这么设计?
(defsubst eieio-eval-default-p (val)
"Whether the default value VAL should be evaluated for use."
(and (consp val) (symbolp (car val)) (fboundp (car val))))