guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#60802] [PATCH v3 1/2] platforms: Raise an exception when no suitabl


From: Maxim Cournoyer
Subject: [bug#60802] [PATCH v3 1/2] platforms: Raise an exception when no suitable platform is found.
Date: Sun, 15 Jan 2023 17:11:40 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Hi Josselin,

Josselin Poiret <dev@jpoiret.xyz> writes:

> Hi Maxim,
>
> 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?

I like exceptions; I think they are an improvement to C-style ad-hoc
checking of each call return; when things fail they fail early and in a
clear fashion, rather than indirectly, which is easier to debug and
removes the burden to duplicate the same checks at every call site.

> 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 think the find interface is well established;
lookup-platform-by-system and friends is not really intended to return
#f, as shown in the few usages in our code base (there's only one place
where it needed to be handled in previous code, and that's a TODO
waiting to move more things to (guix platform)).

> I don't have a particularly strong opinion towards either option, which
> probably means that there's some discussion to be had here.

Good, that's what reviews are for :-).

-- 
Thanks,
Maxim





reply via email to

[Prev in Thread] Current Thread [Next in Thread]