emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [elpa] externals/transient 667ce2b287 18/23: Use transient-default-v


From: Stefan Monnier
Subject: Re: [elpa] externals/transient 667ce2b287 18/23: Use transient-default-value in transient-init-value(suffix)
Date: Wed, 25 Dec 2024 09:14:54 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

Hi Jonas,

> --- a/lisp/transient.el
> +++ b/lisp/transient.el
> @@ -3331,9 +3331,13 @@ Use `transient-default-value' to determine the default 
> value."
>                (cdr saved)
>              (transient-default-value obj)))))
>  
> -(cl-defmethod transient-init-value ((_   transient-suffix))
> -  "Non-infix suffixes usually don't have a value, so this is a noop."
> -  nil)
> +(cl-defmethod transient-init-value ((obj transient-suffix))
> +  "Non-infix suffixes usually don't have a value.
> +Call `transient-default-value' but because that is a noop for
> +`transient-suffix', this function is effectively also a noop."
> +  (let ((value (transient-default-value obj)))
> +    (unless (eq value eieio--unbound)
> +      (oset obj value value))))
>  
>  (cl-defmethod transient-init-value ((obj transient-argument))
>    "Extract OBJ's value from the value of the prefix object."
> @@ -3379,6 +3383,11 @@ that.  If the slot is unbound, return nil."
>          default)
>      nil))
>  
> +(cl-defmethod transient-default-value ((_   transient-suffix))
> +  "Return `eieio--unbound' to indicate that there is no default value.
> +Doing so causes `transient-init-value' to skip setting the `value' slot."
> +  eieio--unbound)
> +
>  ;;;; Read
>  
>  (cl-defgeneric transient-infix-read (obj)

Why use `eieio--unbound` (i.e. a variable internal to EIEIO) rather than
your own magic placeholder?
IOW, is there a good reason to break the abstraction here?


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]