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

From: Xiyue Deng <[email-masked]>
Date: Thu, 07 Dec 2023 11:54:20 -0800

Eli Zaretskii <[email-masked]> writes:

>> From: Xiyue Deng <[email-masked]>
>> Cc: [email-masked]
>> Date: Thu, 07 Dec 2023 09:49:13 -0800
>> 
>> Agreed on the point of being educational, and of course in the end
>> coding style is mostly a matter of personal preference.  However, I
>> would argue a bit that in such case we wouldn't need `if' or `when' at
>> all as both can be emulated by `and' and `or' if you are careful enough.
>> On the other hand, `if' and `when' should exist for a reason.  I quite
>> like this suggestion[1] that `if' and `when' are used to guard side
>> effects, whereas `and' and `or' are used for pure functions.
>> Interestingly the current example you quoted changed from using `and'
>> (as in the old version I quoted) to `if' probably based on this
>> reasoning.  Similarly I wouldn't suggest to replace `if' with `and' in
>> the original example around the text we are discussing:
>> 
>>   (if interprogram-cut-function
>>       (funcall interprogram-cut-function string (not replace))))
>> 
>> as we are also guarding a side effect here.
>> 
>> Wdyt?
>
> Sorry, I don't understand what you mean by "guarding a side effect",

I was referring to whether we care about and use the result of the
statement/function call.  In `and' we do, in `if' we don't and we just
use the side effect.

> and I'm not sure where this discussion goes.  If the issue is personal
> stylistic preferences, then I'd prefer to leave the text as it was
> according to the preferences of the original author (which I happen to
> share, but that's not important).
>
> OK?

As I was just trying to argue just "a bit", I won't be insisting either.
Thanks for listening, and let me close this.

-- 
Xiyue Deng