From mboxrd@z Thu Jan 1 00:00:00 1970 From: Danny Milosavljevic Subject: Re: Making substitute* throw an error if substition failed? Date: Sat, 15 Oct 2016 10:06:41 +0200 Message-ID: <20161015100641.29d0ac0b@scratchpost.org> References: <87twceh9h7.fsf@elephly.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bvJzZ-0006cN-Q7 for guix-devel@gnu.org; Sat, 15 Oct 2016 04:06:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bvJzV-0001Rw-J3 for guix-devel@gnu.org; Sat, 15 Oct 2016 04:06:52 -0400 Received: from dd1012.kasserver.com ([85.13.128.8]:34137) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bvJzV-0001Qe-DX for guix-devel@gnu.org; Sat, 15 Oct 2016 04:06:49 -0400 In-Reply-To: <87twceh9h7.fsf@elephly.net> 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: Ricardo Wurmus Cc: guix-devel Hi, On Sat, 15 Oct 2016 00:05:56 +0200 Ricardo Wurmus wrote: > Would it be desirable to change =E2=80=9Csubstitute*=E2=80=9D (or replace= it) such that > it throws an error or returns a value if substitution failed? 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.) While it's a big change I am for substitute* throwing an error if it can't = find one of the patterns - and #t otherwise. It's true that these substitut= ions that are necessary but cannot be found would not be noticed in a long = time otherwise. I'm against it returning a value #f in the error case - it should just unwi= nd. If you don't want it to unwind (in a few cases) you can always protect = against it manually.