guix-devel
[Top][All Lists]
Advanced

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

Re: Exception: srfi-35 vs (ice-9 exceptions (was Re: [bug#60802] [PATCH


From: Maxim Cournoyer
Subject: Re: Exception: srfi-35 vs (ice-9 exceptions (was Re: [bug#60802] [PATCH v2 1/2] platforms: Raise an exception when no suitable platform is found.)
Date: Mon, 16 Jan 2023 16:59:02 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Hi Simon,

zimoun <zimon.toutoune@gmail.com> writes:

> Hi Maxim,
>
> On Mon, 16 Jan 2023 at 12:46, Maxim Cournoyer <maxim.cournoyer@gmail.com> 
> wrote:
>
>>> So far the we use (srfi srfi-35) exclusively to define condition types;
>>> I think we should do the same here, for consistency.
>>
>> Could we instead start migrating away from srfi-35 to (ice-9
>> exceptions), which is the new native way to use exceptions in Guile?
>
> Well, I think this should be discussed separately.  Therefore,
> -60802@debbugs.gnu.org and +guix-devel. :-)
>
>
>>                                                                       I
>> think it'd be nicer to use it in the future, to avoid newcomers being
>> confusing about the 3 or 4 ways to manage exceptions in Guile
>> (recommended read on the topic:
>> https://vijaymarupudi.com/blog/2022-02-13-error-handling-in-guile.html).
>
> In Guile maybe several but only one in Guix: (srfi srfi-35). :-)

There are also many old-school catch/throw references too, so that makes
it two!  These can technically be handled using the new style mechanism
too (search for "does-not-exist.txt" in [0]), although that may be too
verbose to be an improvement.

[0]  https://vijaymarupudi.com/blog/2022-02-13-error-handling-in-guile.html

>> Migrating the whole code at once doesn't seem a good idea, so gradually
>> transitioning (such as using (ice-9 exceptions) for new code) appears a
>> good idea to me, if we agree on the direction!
>
> Just to note that all Guix is using (srfi srfi-35); except,
>
> 1 candidates:
> ./guix/build/minetest-build-system.scm:26:  #:use-module (ice-9 exceptions)
>
> Therefore, this plan needs to be a bit cooked, otherwise it will become
> quickly a big mess with 2 ways for managing exceptions – and people, at
> least me, will be confused to pick the correct one depending on the
> module.

If we agree on the direction (gradually moving to (ice-9 exceptions))
and that it provides benefits, I think it could be OK to allow for it to
happen gradually (in new or revisited code at least, say), similar to
the approach we're pursuing for the removal of packages and move to
gexps for the package definitions.  Otherwise the scope for the change
is much higher, and it may never materialize.

> Well, if such migration makes sense (I do not know?), from my point of
> view, the migration of the whole code in a short period of time appears
> to me the best; probably with a dedicated WIP branch.

One benefit would be to reduce the friction in using exceptions in
Guile, which is already higher than in other languages in my opinion
(right now you have to import (srfi srfi-35) and typically (srfi
srfi-34) too just to get started).  Having just (ice-9 exceptions) to
deal with would already be an improvement.  I think technically they are
equivalent (probably the same or very similar) under the hood.

-- 
Thanks,
Maxim



reply via email to

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