Subject: Re: bug#67669: 29.1; Drop text suggesting using `and' to replace `if'

From: Xiyue Deng <[email-masked]>
Date: Thu, 07 Dec 2023 01:08:51 -0800

Hi Eli,

Eli Zaretskii <[email-masked]> writes:

>> From: Xiyue Deng <[email-masked]>
>> Date: Wed, 06 Dec 2023 13:47:02 -0800
>> 
>> 
>> In section "the `kill-new' function" - the third last paragraph to be
>> precise - there are some texts in parentheses that discusses potentially
>> using an `and' to replace the `if' statement being discussed.  It looks
>> like to be referring to an earlier version of the code example[1] before
>> using the version from Emacs 22.  Meanwhile, it looks like relying on
>> the side effect of `and' to emulate an `if' may not be a good idea
>> nowadays.  So is it OK to drop this advice?
>
> AFAIU, the relevant fragment is:
>
>      The expression looks like this:
>
> 	 (if interprogram-cut-function
> 	     (funcall interprogram-cut-function string (not replace))))
>
>      If an ‘interprogram-cut-function’ exists, then Emacs executes
>   ‘funcall’, which in turn calls its first argument as a function and
>   passes the remaining arguments to it.  (Incidentally, as far as I can
>   see, this ‘if’ expression could be replaced by an ‘and’ expression
>   similar to the one in the first part of the function.)
>
> I don't see anything wrong here.  Can you elaborate on why you think
> the text in parentheses is inaccurate or incorrect or unclear?

Sorry I wasn't very clear.  I was referring to the part "... could be
replaced by an ‘and’ expression similar to _the one in the first part of
the function_."  But when I tried to search for `and' in the example
code of that section I found no `and' usage at all, which confused me a
bit.  It was not until I looked at the texi source that I noticed that
the original example code did use `and' which I linked in my first
email, and it was later replace by the current one from Emacs 22 which
no longer used `and'.  Thus I would consider the text in the parentheses
you quoted to be obsolete.

And of course as I mentioned in the previous email, IMHO it is probably
not a good advice to use `and' to emulate `if'.

> Thanks.

-- 
Xiyue Deng