GNU bug report logs - #67669
29.1; Drop text suggesting using `and' to replace `if'

Previous Next

Package: emacs;

Reported by: Xiyue Deng <manphiz <at> gmail.com>

Date: Wed, 6 Dec 2023 21:48:01 UTC

Severity: normal

Found in version 29.1

Done: Xiyue Deng <manphiz <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Drew Adams <drew.adams <at> oracle.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Xiyue Deng <manphiz <at> gmail.com>
Cc: "67669 <at> debbugs.gnu.org" <67669 <at> debbugs.gnu.org>
Subject: bug#67669: 29.1; Drop text suggesting using `and' to replace `if'
Date: Fri, 8 Dec 2023 15:37:01 +0000
> (let (baz)
>   (setq foo (concat "bar" (if (stringp baz) baz))))
>   => "bar"
> 
> Here 'if' returns nil, and we use the feature of
> 'concat' to ignore nil arguments.

IMO the meaning/behavior is clearer with `and':

 (let (baz)
   (setq foo (concat "bar" (and (stringp baz) baz))))

But again, such stylistic concerns are exactly that.




This bug report was last modified 1 year and 224 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.