unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Simon Tournier <zimon.toutoune@gmail.com>
Cc: "Josselin Poiret" <dev@jpoiret.xyz>,
	60802@debbugs.gnu.org, "Mathieu Othacehe" <othacehe@gnu.org>,
	"Ludovic Courtès" <ludo@gnu.org>,
	"Tobias Geerinckx-Rice" <me@tobias.gr>,
	"Christopher Baines" <mail@cbaines.net>,
	"Ricardo Wurmus" <rekado@elephly.net>
Subject: [bug#60802] [PATCH v3 1/2] platforms: Raise an exception when no suitable platform is found.
Date: Tue, 17 Jan 2023 09:38:44 -0500	[thread overview]
Message-ID: <87ilh52pl7.fsf@gmail.com> (raw)
In-Reply-To: <87pmbds5jf.fsf@gmail.com> (Simon Tournier's message of "Tue, 17 Jan 2023 13:35:00 +0100")

Hi Simon,

Simon Tournier <zimon.toutoune@gmail.com> writes:

> Hi,
>
> On mar., 17 janv. 2023 at 09:59, Ludovic Courtès <ludo@gnu.org> wrote:
>> Josselin Poiret <dev@jpoiret.xyz> 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’s
>> a precedent with other lookup procedures though
>> (‘lookup-bootloader-by-name’, ‘lookup-compressor’,
>> ‘lookup-image-type-by-name’, etc.), so I think it’s 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: «ask for forgiveness, not permission» 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 “should keep UI
> aspects, such as error reports, separated from core logic”.  This is how
> the exception is handled.  It is often easier to propagate exception
> until an handler than propagate a boolean (as with ’find’).
>
> 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.

-- 
Thanks,
Maxim




  reply	other threads:[~2023-01-17 14:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-14  3:05 [bug#60802] [PATCH 0/2] Remove unsupported u-boot-malta package Maxim Cournoyer
2023-01-14  3:08 ` [bug#60802] [PATCH 1/2] platforms: Raise an exception when no suitable platform is found Maxim Cournoyer
2023-01-14  3:08   ` [bug#60802] [PATCH 2/2] gnu: Remove u-boot-malta Maxim Cournoyer
2023-01-14  4:19 ` [bug#60802] [PATCH v2 1/2] platforms: Raise an exception when no suitable platform is found Maxim Cournoyer
2023-01-14  4:19   ` [bug#60802] [PATCH v2 2/2] gnu: Remove u-boot-malta Maxim Cournoyer
2023-01-14 14:34   ` [bug#60802] [PATCH v2 1/2] platforms: Raise an exception when no suitable platform is found Ludovic Courtès
2023-01-16 17:46     ` Maxim Cournoyer
2023-01-17  9:22       ` Ludovic Courtès
2023-01-14 14:34   ` Ludovic Courtès
2023-01-19  1:55     ` bug#60802: [PATCH 0/2] Remove unsupported u-boot-malta package Maxim Cournoyer
2023-01-14 15:14 ` [bug#60802] [PATCH v3 1/2] platforms: Raise an exception when no suitable platform is found Maxim Cournoyer
2023-01-14 15:14   ` [bug#60802] [PATCH v3 2/2] gnu: Remove u-boot-malta Maxim Cournoyer
2023-01-15 13:57   ` [bug#60802] [PATCH v3 1/2] platforms: Raise an exception when no suitable platform is found Josselin Poiret via Guix-patches via
2023-01-15 22:11     ` Maxim Cournoyer
2023-01-16 11:00     ` Simon Tournier
2023-01-17  8:59     ` Ludovic Courtès
2023-01-17 12:35       ` Simon Tournier
2023-01-17 14:38         ` Maxim Cournoyer [this message]
2023-01-17 15:34 ` [bug#60802] [PATCH v4 0/2] Remove unsupported u-boot-malta package Maxim Cournoyer
2023-01-17 15:34   ` [bug#60802] [PATCH v4 1/2] platforms: Raise an exception when no suitable platform is found Maxim Cournoyer
2023-01-17 15:34   ` [bug#60802] [PATCH v4 2/2] gnu: Remove u-boot-malta Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ilh52pl7.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=60802@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=ludo@gnu.org \
    --cc=mail@cbaines.net \
    --cc=me@tobias.gr \
    --cc=othacehe@gnu.org \
    --cc=rekado@elephly.net \
    --cc=zimon.toutoune@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).