unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 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.)
       [not found]   ` <87mt6i5q4q.fsf@gmail.com>
@ 2023-01-16 20:13     ` zimoun
  2023-01-16 21:59       ` Maxim Cournoyer
  2023-01-16 22:35       ` Ricardo Wurmus
  0 siblings, 2 replies; 7+ messages in thread
From: zimoun @ 2023-01-16 20:13 UTC (permalink / raw)
  To: Maxim Cournoyer, Ludovic Courtès, Guix Devel
  Cc: Tobias Geerinckx-Rice, Josselin Poiret, Mathieu Othacehe,
	Christopher Baines, Ricardo Wurmus

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). :-)


> 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,

--8<---------------cut here---------------start------------->8---
1 candidates:
./guix/build/minetest-build-system.scm:26:  #:use-module (ice-9 exceptions)
--8<---------------cut here---------------end--------------->8---

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.

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.

Cheers,
simon


^ permalink raw reply	[flat|nested] 7+ messages in thread

* 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.)
  2023-01-16 20:13     ` 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.) zimoun
@ 2023-01-16 21:59       ` Maxim Cournoyer
  2023-01-17 16:35         ` Ludovic Courtès
  2023-01-16 22:35       ` Ricardo Wurmus
  1 sibling, 1 reply; 7+ messages in thread
From: Maxim Cournoyer @ 2023-01-16 21:59 UTC (permalink / raw)
  To: zimoun
  Cc: Ludovic Courtès, Guix Devel, Tobias Geerinckx-Rice,
	Josselin Poiret, Mathieu Othacehe, Christopher Baines,
	Ricardo Wurmus

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* 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.)
  2023-01-16 20:13     ` 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.) zimoun
  2023-01-16 21:59       ` Maxim Cournoyer
@ 2023-01-16 22:35       ` Ricardo Wurmus
  2023-01-17 19:58         ` Josselin Poiret
  1 sibling, 1 reply; 7+ messages in thread
From: Ricardo Wurmus @ 2023-01-16 22:35 UTC (permalink / raw)
  To: zimoun
  Cc: Maxim Cournoyer, Ludovic Courtès, Guix Devel,
	Tobias Geerinckx-Rice, Josselin Poiret, Mathieu Othacehe,
	Christopher Baines


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

> 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?  
[…]
>> 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). :-)

With the introduction of (ice-9 exceptions), SRFI 35 has also been
rebased on top of it.[1]

Personally, I’d rather stay with the well-established interface provided
by SRFI 35.  It seems like needless churn to rewrite all current
exception handling to drop down one layer onto Guile-specific
infrastructure.

-- 
Ricardo

[1]: https://lists.gnu.org/archive/html/guile-commits/2019-11/msg00002.html


^ permalink raw reply	[flat|nested] 7+ messages in thread

* 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.)
  2023-01-16 21:59       ` Maxim Cournoyer
@ 2023-01-17 16:35         ` Ludovic Courtès
  0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2023-01-17 16:35 UTC (permalink / raw)
  To: Maxim Cournoyer
  Cc: zimoun, Guix Devel, Tobias Geerinckx-Rice, Josselin Poiret,
	Mathieu Othacehe, Christopher Baines, Ricardo Wurmus

Hi!

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

> 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

Well, yes and no.  The migration to from key+args (what ‘catch’ deals
with) to exception objects (à la SRFI-35 or (ice-9 exceptions)) was
started in 3.0, but it’s not “complete” in the sense that internally
key+args is still what’s used in the vast majority of cases.  Quoth
‘NEWS’:

  Guile's situation is transitional.  Most exceptions are still signalled
  via `throw'.  These will probably migrate over time to
  `raise-exception', while preserving compatibility of course.

So I guess the first task is to work on it in Guile proper.

I do hope we can eventually do away with ‘catch’ in most parts of the
code and stick to SRFI-34 ‘guard’.

Thanks,
Ludo’.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* 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.)
  2023-01-16 22:35       ` Ricardo Wurmus
@ 2023-01-17 19:58         ` Josselin Poiret
  2023-01-19 14:38           ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Josselin Poiret @ 2023-01-17 19:58 UTC (permalink / raw)
  To: Ricardo Wurmus, zimoun
  Cc: Maxim Cournoyer, Ludovic Courtès, Guix Devel,
	Tobias Geerinckx-Rice, Mathieu Othacehe, Christopher Baines

Hi everyone,

I also don't see how Guix would gain anything from moving
to Guile's native exceptions.  However, one thing that would be nice to
have is a description of all such "implementation choices" in Guix,
perhaps in the "Coding style" section of the manual.  Having a
definitive reference to what is the current accepted coding style would
probably help newcomers, more than the actual choice of one specifi
implementation over another.

Best,
-- 
Josselin Poiret


^ permalink raw reply	[flat|nested] 7+ messages in thread

* 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.)
  2023-01-17 19:58         ` Josselin Poiret
@ 2023-01-19 14:38           ` Ludovic Courtès
  2023-01-19 15:59             ` Katherine Cox-Buday
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2023-01-19 14:38 UTC (permalink / raw)
  To: Josselin Poiret
  Cc: Ricardo Wurmus, zimoun, Maxim Cournoyer, Guix Devel,
	Tobias Geerinckx-Rice, Mathieu Othacehe, Christopher Baines

Hi,

Josselin Poiret <dev@jpoiret.xyz> skribis:

> I also don't see how Guix would gain anything from moving
> to Guile's native exceptions.  However, one thing that would be nice to
> have is a description of all such "implementation choices" in Guix,
> perhaps in the "Coding style" section of the manual.  Having a
> definitive reference to what is the current accepted coding style would
> probably help newcomers, more than the actual choice of one specifi
> implementation over another.

Agreed.  Let’s add exceptions under “Coding Style”, and if anything else
comes to mind, we can add it too!

Ludo’.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* 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.)
  2023-01-19 14:38           ` Ludovic Courtès
@ 2023-01-19 15:59             ` Katherine Cox-Buday
  0 siblings, 0 replies; 7+ messages in thread
From: Katherine Cox-Buday @ 2023-01-19 15:59 UTC (permalink / raw)
  To: Ludovic Courtès
  Cc: Josselin Poiret, Ricardo Wurmus, zimoun, Maxim Cournoyer,
	Guix Devel, Tobias Geerinckx-Rice, Mathieu Othacehe,
	Christopher Baines

Ludovic Courtès <ludo@gnu.org> writes:

> Hi,
>
> Josselin Poiret <dev@jpoiret.xyz> skribis:
>
>> I also don't see how Guix would gain anything from moving to Guile's
>> native exceptions. However, one thing that would be nice to have is a
>> description of all such "implementation choices" in Guix, perhaps in
>> the "Coding style" section of the manual. Having a definitive
>> reference to what is the current accepted coding style would probably
>> help newcomers, more than the actual choice of one specifi
>> implementation over another.
>
> Agreed. Let’s add exceptions under “Coding Style”, and if anything
> else comes to mind, we can add it too!

And a lint check too? :)

-- 
Katherine


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-01-19 15:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230114041903.7121-2-maxim.cournoyer@gmail.com>
     [not found] ` <87o7r19ocn.fsf@gnu.org>
     [not found]   ` <87mt6i5q4q.fsf@gmail.com>
2023-01-16 20:13     ` 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.) zimoun
2023-01-16 21:59       ` Maxim Cournoyer
2023-01-17 16:35         ` Ludovic Courtès
2023-01-16 22:35       ` Ricardo Wurmus
2023-01-17 19:58         ` Josselin Poiret
2023-01-19 14:38           ` Ludovic Courtès
2023-01-19 15:59             ` Katherine Cox-Buday

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).