emacs-devel
[Top][All Lists]
Advanced

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

Re: [nongnu] elpa/hyperdrive b5294b4354 4/4: Tidy: Use zerop instead of


From: Philip Kaludercic
Subject: Re: [nongnu] elpa/hyperdrive b5294b4354 4/4: Tidy: Use zerop instead of = 0
Date: Sun, 15 Oct 2023 09:17:56 +0000

You dropped me out of the CC's.

Emanuel Berg <incal@dataswamp.org> writes:

> Philip Kaludercic wrote:
>
>> FWIW this doesn't matter that much, you can check the
>> disassembly to see what is going on after byte compilation:
>>
>> (disassemble (byte-compile (lambda (a) (= a 0))))
>
> byte code:
>   args: (a)
> 0       varref    a
> 1       constant  0
> 2       eqlsign   
> 3       return    
>
>> (disassemble (byte-compile (lambda (a) (zerop a))))
>
> byte code:
>   args: (a)
> 0       varref    a
> 1       constant  0
> 2       eqlsign   
> 3       return    
>
> They are identical, is that what you mean it doesn't matter
> that much?

My comment was just to indicate that there is no need to change from one
to the other, e.g. for performance reasons (which would have been my
intuition), but also as a reminder to check the result of byte
compilation.

> To use `zerop' is maybe more classy - the attitude being to
> minimize everything as much as possible - as it is a unary
> function (1 argument) while `=', as it is used here, is binary
> (2 arguments).
>
> BTW = can be used unary as well, then it always returns t -
> even for nil. (= nil) ; t
>
> But why do that? As it is more classy to just use t :)

I guess?



reply via email to

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