From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 20:37:30 2021 Received: (at 50614) by debbugs.gnu.org; 17 Sep 2021 00:37:30 +0000 Received: from localhost ([127.0.0.1]:57943 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mR1sg-00068t-Hr for submit@debbugs.gnu.org; Thu, 16 Sep 2021 20:37:30 -0400 Received: from out2.migadu.com ([188.165.223.204]:47882) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mR1sd-00068g-L5 for 50614@debbugs.gnu.org; Thu, 16 Sep 2021 20:37:29 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1631839046; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a4189ToxF8Lyjx7eWNVvTuEaAidd1nlJ7QpfDWAqB+U=; b=T5GGDlhIK7jJw17sl12VDUeuJau9LdYDpPnzxmf+F1IBltzUE64QApe/r+MqKMl9MFQ/LT CMFdWeKV7HtN722peEh3Ff1P6V/aOBtKDsh7plNQYSXklmASky2icjGy+MRPrZ6HVwMjoP pfZn4Z99auB6/13ueN87XSC/JXPlL38= From: Sarah Morgensen To: Xinglu Chen Subject: Re: [bug#50614] [PATCH core-updates] build: utils: Add =?utf-8?B?4oCYb3B0aW9uYWzigJk=?= macro. References: Date: Thu, 16 Sep 2021 17:37:24 -0700 In-Reply-To: (Xinglu Chen's message of "Thu, 16 Sep 2021 09:11:22 +0200 (17 hours, 10 minutes, 11 seconds ago)") Message-ID: <864kakhwaj.fsf@mgsn.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: iskarian@mgsn.dev X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi, Xinglu Chen writes: > * guix/build/utils.scm (optional): New syntax > * tests/build-utils.scm ("optional: expr1 is non-#f", optional: expr1 is #f"): > Test it. > * guix.texi (Build Utilities): Document it. > --- > A comm [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [188.165.223.204 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Debbugs-Envelope-To: 50614 Cc: 50614@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Hi, Xinglu Chen writes: > * guix/build/utils.scm (optional): New syntax > * tests/build-utils.scm ("optional: expr1 is non-#f", optional: expr1 is = #f"): > Test it. > * guix.texi (Build Utilities): Document it. > --- > A common idiom I have seen is > > (if EXPR1 > EXPR2 > '()) > > with the =E2=80=98optional=E2=80=99 macro, one can just write > > (optional EXPR1 > EXPR2) > > I am not sure if =E2=80=98optional=E2=80=99 is the best name (it was insp= ired by > =E2=80=98lib.optional=E2=80=99 in Nixpkgs), feedback welcome! I like the idea! But perhaps if we're getting rid of boilerplate, we should go all the way and make it so that instead of (if EXPR1 `(EXPR2 EXPR3) '()) we can write (optional EXPR1 EXPR2 EXPR3) What do you think? Also, maybe 'list-when' for the name? > +@deffn {Scheme Syntax} optional @var{test} @var{consequent} > +Like @code{when} (@pxref{Conditionals,,, guile, GNU Guile Reference > +Manual}), but if @var{test} evaluates to false, return the empty list. > +This is replaces the following idiom: ^ no "is" > +@end deffn > + > +@lisp > +(if @var{test} > + @var{consequent} > + '()) > +@end lisp > + > +with this: > + > +@lisp > +(optional @var{test} > + @var{consequent}) > +@end lisp=20=20=20=20=20=20=20=20=20=20 > + > +It can be useful when certain targets require an additional configure ^ no "an" > +flags, e.g., > + > +@lisp > +(arguments > + `(#:configure-flags (list "--localstatedir=3D/var" > + "--sysconfdir=3D/etc" > + ,@@(optional (hurd-target?) '("--with-courage= ")))) ^ extra "@"? -- Sarah