unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Josselin Poiret via Guix-patches via <guix-patches@gnu.org>
To: mirai <mirai@makinata.eu>, 60014@debbugs.gnu.org
Subject: [bug#60014] [PATCH] activation: make install-special-file match against pairs as well.
Date: Tue, 13 Dec 2022 11:15:34 +0100	[thread overview]
Message-ID: <87h6xzfw3d.fsf@jpoiret.xyz> (raw)
In-Reply-To: <7f00edbf-8b39-0d3e-4d29-0815176d143c@makinata.eu>

Hi Bruno,

mirai <mirai@makinata.eu> writes:

> The documentation for it says:
> --8<---------------cut here---------------start------------->8---
> The value associated with special-files-service-type services must be a list of tuples where the first element is the “special file” and the second element is its target. 
> --8<---------------cut here---------------end--------------->8---
>
> Which I think is the natural way of doing it. (and communicates the intent, a pair with a path and a file-like object.)

Right, that's unfortunate, although that could be changed to “list of
lists” to make it clearer.

> Of course, (list "path" file-like-obj) works as well but imo the pair is clearer in purpose.
> (what meaning would the third element and so on have, if ever present?)
> This I found out the hard way by getting strange errors until I looked into what happens behind
> `special-files-service-type' and realizing that only lists were accepted.
>
> The mixing of cases is unfortunate (it should have been pairs from the start) but preserves
> compatibility with existing syntax. 

I agree with you here, but then I think to avoid having to maintain both
cases at the same time, all existing uses of special-files-service-type
should also be modified, and only one kind should remain, with the other
triggering some deprecation warning.  You could match to `(path
. file-like)`, and if (list? file-like), throw an exception.

As a sidenote, the main problem is that Guile is not a statically typed
language, but that's a whole other debate to have.

In any case, I don't think this patch will be accepted as-is.  I would
only be partially in favor of the second solution (because it breaks
existing code), while the first solution is low-effort and should work
well enough.  Up to you (and maintainers) to decide.

Best,
-- 
Josselin Poiret




  reply	other threads:[~2022-12-13 10:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12 17:45 [bug#60014] [PATCH] activation: make install-special-file match against pairs as well mirai
2022-12-12 20:34 ` Josselin Poiret via Guix-patches via
2022-12-12 20:52   ` Tobias Geerinckx-Rice via Guix-patches via
2022-12-12 22:25     ` mirai
2022-12-13 20:04       ` Tobias Geerinckx-Rice via Guix-patches via
2022-12-12 22:09   ` mirai
2022-12-13 10:15     ` Josselin Poiret via Guix-patches via [this message]
2022-12-13 13:04       ` mirai
2022-12-13 19:56         ` Josselin Poiret via Guix-patches via
2022-12-20 14:47   ` Ludovic Courtès
2022-12-21 13:20     ` mirai
2022-12-21 13:31 ` [bug#60014] [PATCH v2] doc: Clarify special-files-service-type expected value mirai
2023-02-18  2:33   ` Bruno Victal
2023-03-21 14:15   ` bug#60014: " 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=87h6xzfw3d.fsf@jpoiret.xyz \
    --to=guix-patches@gnu.org \
    --cc=60014@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=mirai@makinata.eu \
    /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).