From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id HuuHOBezxmN7pwAAbAwnHQ (envelope-from ) for ; Tue, 17 Jan 2023 15:39:20 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id gBFzNxezxmNEhAEAauVa8A (envelope-from ) for ; Tue, 17 Jan 2023 15:39:19 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 761AB2D3B5 for ; Tue, 17 Jan 2023 15:39:19 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHn7A-0003on-HY; Tue, 17 Jan 2023 09:39:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pHn78-0003o9-M7 for guix-patches@gnu.org; Tue, 17 Jan 2023 09:39:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pHn78-00050C-DH for guix-patches@gnu.org; Tue, 17 Jan 2023 09:39:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pHn78-0001HU-8i for guix-patches@gnu.org; Tue, 17 Jan 2023 09:39:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60802] [PATCH v3 1/2] platforms: Raise an exception when no suitable platform is found. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 17 Jan 2023 14:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60802 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Simon Tournier Cc: Josselin Poiret , 60802@debbugs.gnu.org, Mathieu Othacehe , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Tobias Geerinckx-Rice , Christopher Baines , Ricardo Wurmus Received: via spool by 60802-submit@debbugs.gnu.org id=B60802.16739663344903 (code B ref 60802); Tue, 17 Jan 2023 14:39:02 +0000 Received: (at 60802) by debbugs.gnu.org; 17 Jan 2023 14:38:54 +0000 Received: from localhost ([127.0.0.1]:36231 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHn6z-0001H1-TD for submit@debbugs.gnu.org; Tue, 17 Jan 2023 09:38:54 -0500 Received: from mail-qt1-f176.google.com ([209.85.160.176]:38785) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHn6y-0001Gm-5g for 60802@debbugs.gnu.org; Tue, 17 Jan 2023 09:38:52 -0500 Received: by mail-qt1-f176.google.com with SMTP id z9so4632107qtv.5 for <60802@debbugs.gnu.org>; Tue, 17 Jan 2023 06:38:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=l7SjIEEn1BeqjzslopkzoPu9/EISnPge3yYiGrw8p+8=; b=c3GRBjiicg8+9Kmtx08JNgZkiIhLok177DHey262sKuAsLwoRqkRE3JW3I/ljsY6XL hoHceIMnuo+HgOFNJg+CzeFjQ7ngby+QMNo5bQbNGenFMOj1OHqGaD7by85ZQk1hU3bv D+/tClBo82qIDVaoq/eRG8jGEDQ5uVl5qwSVAzFGpsk8Igg6iDM2rxGWst+em/k/EfsZ mYXD7k83QGWnGh3wRx68HlkelZr0FCdDHV//5UMQ8C5VjNg3IbTz52h51MKHKnuQCNxM or4ODX27xETyqVDoso3HIW9Wxcsyn3nvc3C8jbasAYgZCtpAzcXT2cE8FwarvSAA14LJ Z5AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=l7SjIEEn1BeqjzslopkzoPu9/EISnPge3yYiGrw8p+8=; b=kgXvLcoeQC1l4MwDrH4oEnydvIBCEStfikkAw66j3brBPXfMVRbP8zYevDGg7IWfXT e3FS0p/UpG85TpINadaIFOhadq0fZKkbiwR3tpGCjGliN0pNG5JHw1lHnaCirtCA/TZN 3GNT9Yp5xlF65WwI6EJ3S+NHNJael5g2buiXHGjyam+PZY/DCsa4W2kpvTNQnEW7UZ0H R2xpyLb5M8fBd/TVlj4TgtKrjZBeghPck/i8iZFZ8Ms82CNOehr91gZo8hcMVoXdYN9M Bg0c0uQC6SWr2EWNKRn7PblMQtGz1KB8rTXww/YolP54cp2V8ZUElGotmFq4P9oOErw7 kioQ== X-Gm-Message-State: AFqh2kpVpjyY7mrAYRUplWKWwdXZaMx3jYF61KARvoxdBqXVStynzl+L kOKE8AlTfLDNQ1ROySJ6GDg= X-Google-Smtp-Source: AMrXdXtQbKOhwOpz/sUo27I1YGxiE0BVGHVdkbetcGJojbHdOJ0djY/wHOtgv7mzUsTq6XSylG/uyw== X-Received: by 2002:a05:622a:8c8:b0:3b6:2da4:a896 with SMTP id i8-20020a05622a08c800b003b62da4a896mr4584937qte.43.1673966326568; Tue, 17 Jan 2023 06:38:46 -0800 (PST) Received: from hurd (dsl-205-233-125-107.b2b2c.ca. [205.233.125.107]) by smtp.gmail.com with ESMTPSA id k4-20020ac84744000000b003b630ea0ea1sm3048821qtp.19.2023.01.17.06.38.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 06:38:46 -0800 (PST) From: Maxim Cournoyer References: <20230114151457.1903-2-maxim.cournoyer@gmail.com> <87zgajkiiy.fsf@jpoiret.xyz> <87r0vtk03h.fsf@gnu.org> <87pmbds5jf.fsf@gmail.com> Date: Tue, 17 Jan 2023 09:38:44 -0500 In-Reply-To: <87pmbds5jf.fsf@gmail.com> (Simon Tournier's message of "Tue, 17 Jan 2023 13:35:00 +0100") Message-ID: <87ilh52pl7.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1673966359; a=rsa-sha256; cv=none; b=Ww328FPcsbUnWZJC+MIW2ouaQXMQ9BvCpxw0DVnFmTQeVeHg5dcUc4vwCJ0kVlqVhjXedP aznGaOqTLQAzyuQr2kaclMSflU+JzcXtvTgCSG21+uPicyponCToP8v3vjQXxkhmYOVvy4 P1UTe3Kz0pefgTUAHr1YYp5j4tBA+SpLlVGrDcbYVwNM5mvTzaoUHsmCFtcyyaE7kMc08z wuJhobg+p2Wai920gg+rMZK/26CbEUhQL1EsDi/1yO7eEYHlO8RFw3KjZbxSk68ktnkfwp 6FZTnBMiFvL9a32GaaS27IYB5KvEled57TA8uYAuaxjrH9adVCBD/vKMbiwKwg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=c3GRBjii; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1673966359; h=from:from:sender:sender: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:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=l7SjIEEn1BeqjzslopkzoPu9/EISnPge3yYiGrw8p+8=; b=nn76tm9pN6FPVDBMIWrU1hOkuuuVTrkpbk0A1L4KSvMLGAg575QvQm/PyCQfwOQP0JJ664 Iwd8cDD+9ZgWEtcFuCJqjmRDT53QNdFNMfpc17LSWPzO87XQdHEldOZw5JzWPZs7bJeY1n EDyEOUT/Um7LueA1g12zXMQ/y7CP8RFH+obu7Cr+GVFKpOXnqk87CAG7EHApht6BJFHk1o 4Rkws0syZnvSC/zmcpc1K/+sgjhKkYiQJAQ7pVnE8AenTuziXBhuTtkTdWQHaw4U+vtTmj DGRwhieW0fvNZNqBmEtrP7W2gM+fY8BxCoWDWuqntiEp7HObrXx+TvznQ9kkAg== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -0.53 X-Spam-Score: -0.53 X-Migadu-Queue-Id: 761AB2D3B5 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=c3GRBjii; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-TUID: NZM0Igs4iZsh Hi Simon, Simon Tournier writes: > Hi, > > On mar., 17 janv. 2023 at 09:59, Ludovic Court=C3=A8s wrot= e: >> Josselin Poiret skribis: >> >>> This looks good to me, although in the grand scheme of things I wonder >>> if that change is a step forward: for those kinds of procedures, we >>> could expect consumers to instead always properly handle the #f case >>> themselves, rather than baby-sitting them and systematically relying on >>> exceptions in the parent procedure, no? As a caricatural example: the >>> SRFI-1 `find` could raise an exception instead of returning #f, but I >>> don't think anyone would consider that proper behaviour. >> >> I share this sentiment in general (plus the fact that we should keep UI >> aspects, such as error reports, separate from core logic). Here there= =E2=80=99s >> a precedent with other lookup procedures though >> (=E2=80=98lookup-bootloader-by-name=E2=80=99, =E2=80=98lookup-compressor= =E2=80=99, >> =E2=80=98lookup-image-type-by-name=E2=80=99, etc.), so I think it=E2=80= =99s okay to keep it that >> way. > > Well, from my small experience with other programming language, they > barely do return a boolean when they fail. I think this way using a > boolean is because some historical reasons when exceptions was not > implemented in Scheme (or other languages). > > Exception allows the motto: =C2=ABask for forgiveness, not permission=C2= =BB while > keeping under control the side effects. Well, IMHO exception is often a > good practise for dynamically typed programming language; as Scheme (or > Python). > > From my point of view, exception is not related to =E2=80=9Cshould keep UI > aspects, such as error reports, separated from core logic=E2=80=9D. This= is how > the exception is handled. It is often easier to propagate exception > until an handler than propagate a boolean (as with =E2=80=99find=E2=80=99= ). > > And if the exception is not handled, then it just returns a backtrace, > which is more informative, IMHO. You've summarized well the reasons I think using an exception here makes sense (and why using exceptions rather than C-style booleans to propagate error conditions is preferable in general for languages where it's possible to do so -- luckily Scheme is one). I'll send a v4 reworking it to use srfi-34/35, so that the discussion to migrate to (ice-9 exceptions) can be kept separate. --=20 Thanks, Maxim