all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: master 6ebce84ff2b: Use t for non-nil default values in boolean defcustom declarations
       [not found] ` <20230428130816.81449C22A07@vcs2.savannah.gnu.org>
@ 2023-04-29  7:39   ` Michael Albinus
  2023-04-29  9:03     ` Mattias Engdegård
  2023-04-29 11:23     ` Andreas Schwab
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Albinus @ 2023-04-29  7:39 UTC (permalink / raw)
  To: emacs-devel; +Cc: Mattias Engdegård

Mattias Engdegård <mattiase@acm.org> writes:

Hi Mattias,

>     Use t for non-nil default values in boolean defcustom declarations
>
> +(defcustom viper-ms-style-os-p
> +  (not (not (memq system-type '(ms-dos windows-nt))))

I'm just curious. Is there an advantage in using the (not (not ...))
pattern? I would use (and ... t) instead, but perhaps your pattern is
more performant? Or is it just a personal style?

Best regards, Michael.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master 6ebce84ff2b: Use t for non-nil default values in boolean defcustom declarations
  2023-04-29  7:39   ` master 6ebce84ff2b: Use t for non-nil default values in boolean defcustom declarations Michael Albinus
@ 2023-04-29  9:03     ` Mattias Engdegård
  2023-04-29 11:07       ` Michael Albinus
  2023-04-29 11:23     ` Andreas Schwab
  1 sibling, 1 reply; 6+ messages in thread
From: Mattias Engdegård @ 2023-04-29  9:03 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-devel

29 apr. 2023 kl. 09.39 skrev Michael Albinus <michael.albinus@gmx.de>:

> I'm just curious. Is there an advantage in using the (not (not ...))
> pattern? I would use (and ... t) instead, but perhaps your pattern is
> more performant? Or is it just a personal style?

I have no particular preference for either. If (and X t) is generally better liked, then it's fine to change to that.

Right now (not (not X)) is often but not always slightly shorter and faster but it doesn't matter in these cases and we could easily make both generate identical code.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master 6ebce84ff2b: Use t for non-nil default values in boolean defcustom declarations
  2023-04-29  9:03     ` Mattias Engdegård
@ 2023-04-29 11:07       ` Michael Albinus
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Albinus @ 2023-04-29 11:07 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: emacs-devel

Mattias Engdegård <mattiase@acm.org> writes:

Hi Mattias,

>> I'm just curious. Is there an advantage in using the (not (not ...))
>> pattern? I would use (and ... t) instead, but perhaps your pattern is
>> more performant? Or is it just a personal style?
>
> I have no particular preference for either. If (and X t) is generally better liked, then it's fine to change to that.

Thanks for the reply. No, I don't believe it is needed to change your
personal style :-)

Best regards, Michael.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master 6ebce84ff2b: Use t for non-nil default values in boolean defcustom declarations
  2023-04-29  7:39   ` master 6ebce84ff2b: Use t for non-nil default values in boolean defcustom declarations Michael Albinus
  2023-04-29  9:03     ` Mattias Engdegård
@ 2023-04-29 11:23     ` Andreas Schwab
  2023-05-02  8:03       ` Robert Pluim
  1 sibling, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2023-04-29 11:23 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-devel, Mattias Engdegård

On Apr 29 2023, Michael Albinus wrote:

> Mattias Engdegård <mattiase@acm.org> writes:
>
> Hi Mattias,
>
>>     Use t for non-nil default values in boolean defcustom declarations
>>
>> +(defcustom viper-ms-style-os-p
>> +  (not (not (memq system-type '(ms-dos windows-nt))))
>
> I'm just curious. Is there an advantage in using the (not (not ...))
> pattern?

Logically, (not (null ...)) would fit better.

(not is just an alias of null, so both are the same, of course).

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master 6ebce84ff2b: Use t for non-nil default values in boolean defcustom declarations
  2023-04-29 11:23     ` Andreas Schwab
@ 2023-05-02  8:03       ` Robert Pluim
  2023-05-02 16:42         ` Andreas Schwab
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Pluim @ 2023-05-02  8:03 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Michael Albinus, emacs-devel, Mattias Engdegård

>>>>> On Sat, 29 Apr 2023 13:23:42 +0200, Andreas Schwab <schwab@linux-m68k.org> said:

    Andreas> On Apr 29 2023, Michael Albinus wrote:
    >> Mattias Engdegård <mattiase@acm.org> writes:
    >> 
    >> Hi Mattias,
    >> 
    >>> Use t for non-nil default values in boolean defcustom declarations
    >>> 
    >>> +(defcustom viper-ms-style-os-p
    >>> +  (not (not (memq system-type '(ms-dos windows-nt))))
    >> 
    >> I'm just curious. Is there an advantage in using the (not (not ...))
    >> pattern?

    Andreas> Logically, (not (null ...)) would fit better.

    Andreas> (not is just an alias of null, so both are the same, of course).

Yes, but (not (not ...)) maps nicely to '!!' in C

Iʼm very curious if this change will cause any issues :-)

Robert
-- 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master 6ebce84ff2b: Use t for non-nil default values in boolean defcustom declarations
  2023-05-02  8:03       ` Robert Pluim
@ 2023-05-02 16:42         ` Andreas Schwab
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Schwab @ 2023-05-02 16:42 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Michael Albinus, emacs-devel, Mattias Engdegård

On Mai 02 2023, Robert Pluim wrote:

>>>>>> On Sat, 29 Apr 2023 13:23:42 +0200, Andreas Schwab <schwab@linux-m68k.org> said:
>
>     Andreas> On Apr 29 2023, Michael Albinus wrote:
>     >> Mattias Engdegård <mattiase@acm.org> writes:
>     >> 
>     >> Hi Mattias,
>     >> 
>     >>> Use t for non-nil default values in boolean defcustom declarations
>     >>> 
>     >>> +(defcustom viper-ms-style-os-p
>     >>> +  (not (not (memq system-type '(ms-dos windows-nt))))
>     >> 
>     >> I'm just curious. Is there an advantage in using the (not (not ...))
>     >> pattern?
>
>     Andreas> Logically, (not (null ...)) would fit better.
>
>     Andreas> (not is just an alias of null, so both are the same, of course).
>
> Yes, but (not (not ...)) maps nicely to '!!' in C

C doesn't have lists, and memq returns a list.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-05-02 16:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <168268729579.28551.10245924430337302769@vcs2.savannah.gnu.org>
     [not found] ` <20230428130816.81449C22A07@vcs2.savannah.gnu.org>
2023-04-29  7:39   ` master 6ebce84ff2b: Use t for non-nil default values in boolean defcustom declarations Michael Albinus
2023-04-29  9:03     ` Mattias Engdegård
2023-04-29 11:07       ` Michael Albinus
2023-04-29 11:23     ` Andreas Schwab
2023-05-02  8:03       ` Robert Pluim
2023-05-02 16:42         ` Andreas Schwab

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.