From mboxrd@z Thu Jan 1 00:00:00 1970 From: Efraim Flashner Subject: Re: Making substitute* throw an error if substition failed? Date: Tue, 18 Oct 2016 00:08:36 +0300 Message-ID: <20161017210836.GF14171@macbook42.flashner.co.il> References: <87twceh9h7.fsf@elephly.net> <874m4bfjfn.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="NQTVMVnDVuULnIzU" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwF9J-00038w-Io for guix-devel@gnu.org; Mon, 17 Oct 2016 17:08:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwF9G-0008Av-GK for guix-devel@gnu.org; Mon, 17 Oct 2016 17:08:45 -0400 Content-Disposition: inline In-Reply-To: <874m4bfjfn.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel --NQTVMVnDVuULnIzU Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 17, 2016 at 10:50:36AM +0200, Ludovic Court=C3=A8s wrote: > Hi, >=20 > Ricardo Wurmus skribis: >=20 > > it happened a couple of times already that a =E2=80=9Csubstitute*=E2=80= =9D expression > > silently failed and I only found out about it when investigating the > > remains of a failing build (=E2=80=9Cguix build -K=E2=80=9D). This can= easily happen > > when a package is updated and substitutions =E2=80=9Canchors=E2=80=9D n= o longer exist in > > the updated source code. > > > > Would it be desirable to change =E2=80=9Csubstitute*=E2=80=9D (or repla= ce it) such that > > it throws an error or returns a value if substitution failed? >=20 > =E2=80=9CFailed=E2=80=9D as in =E2=80=9Cthere were no pattern matches=E2= =80=9D, right? >=20 Or as in "your regex was bad, try again" > > This might be helpful for the more complex packages with many > > substitutions. If we make it return a value (#f for error) it would > > also make our build phases a little prettier, I think. (Now we > > forcefully return #t in any case and that seems wrong.) >=20 > I like this idea. Like others wrote, it could return #t if one or more > substitutions were made, and #f otherwise. >=20 > I think it=E2=80=99s better than throwing an error, because there are cas= es > where it doesn=E2=80=99t matter whether a substitution was made or not (e= =2Eg., > when replacing strings en masse on a set of files.) >=20 > WDYT? >=20 > Thanks, > Ludo=E2=80=99. >=20 I would go with '#t if one or more subsitutions were made, regardless of the number of files specified' rather than '#t if 1+ substitutions on every (all) file listed'. --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --NQTVMVnDVuULnIzU Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCgAGBQJYBT3TAAoJEPTB05F+rO6TlmAP/j5NFw746w8vNUqftOiaTY6D Su/KVokhBWUxLOhApJ/prl3bT9ZfX4zb/llZkCUoeib3yWW+eM8dU/KbCE0Dz/wW Af0L1A2efgZWfH1Kg6ueJ3mZs4L5c4F6hRpAGhrxb9BADrWXImflE12Z0x+4TG81 SFn+f7BzXBtsgpx2w+aiuv1wu3x4iVlz7gKlZL176L75zH+2LvD06cbXGegFNjbN MVlJ8+ctSg+XsOYwT6RzbZmv1KhkMBZSc8n3a3WmWJVGZm/r9Nyg0oea1ZFAN1PS Fh0Vqa1b0ohFPKOQM2lNLXPgVrbjDZrXdSuAYVgcB9LKwx+XaCa2nhIQ+FgGE1vb k1A67Eukdi+xL6op2gIkUeHjhynrieVdLJhSLPf0khYlhGP3v5FkqxminVMg0PFf 1rCYN7GV6hWnKZKHK2zGWB9db/wsirl4oXvPL1HMC4i30wH91/Nv9qdYph1KjgB7 uvDq1zw7c/fB3OwNlxr1B5/b4Zjv6ufRgn9caX10n56K1T+YG4wGOimlOgS7SqGG LKHEDU2j5wGLlxoD4xKzYeb+4aQ0sxnp7Mp8MJ8iF9V5HSnhq3ZlnfVIm2GMBqMT P0P8/NU9QY/7nYNNbmYoBicuTKtjRAsvuXPA+UAADiqpIGJ9mSQVJqNqGQ9T/+vP DQL8ot3QWGnjcITzlNwx =3vnY -----END PGP SIGNATURE----- --NQTVMVnDVuULnIzU--