unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Jelle Licht <jlicht@fsfe.org>
To: zimoun <zimon.toutoune@gmail.com>, Guix Devel <guix-devel@gnu.org>
Subject: Re: Convention for new “guix style“?
Date: Wed, 22 Dec 2021 15:10:58 +0100	[thread overview]
Message-ID: <86a6gsd91p.fsf@fsfe.org> (raw)
In-Reply-To: <86bl18sscd.fsf@gmail.com>

Hi,

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

> Hi,
>
> This could be part of a RFC process. :-)
>
>
> The Big Change introduces new style, other said, this old
>
> --8<---------------cut here---------------start------------->8---
>      (native-inputs
>      `(("perl" ,perl)
>        ("pkg-config" ,pkg-config)))
> --8<---------------cut here---------------end--------------->8---
>
> is replaced by this new,
>
> --8<---------------cut here---------------start------------->8---
>      (native-inputs
>       (list perl pkg-config))
> --8<---------------cut here---------------end--------------->8---
>
> It removes all the labels. \o/  More details [1].
>
>
> We had a discussion on IRC starting here [2].  This proposal is to
> document in the manual and adapt ‘guix style’ to have one input per line
> – as it was the case with the old style.
>
> Aside preference, for instance, I find easier to read,
>
> --8<---------------cut here---------------start------------->8---
>     (inputs                             ;required for test
>      (list julia-chainrulestestutils
>            julia-finitedifferences
>            julia-nanmath
>            julia-specialfunctions))
>     (propagated-inputs
>      (list julia-chainrulescore
>            julia-compat
>            julia-reexport
>            julia-requires))
> --8<---------------cut here---------------end--------------->8---
>
> than
>
> --8<---------------cut here---------------start------------->8---
>     (inputs                             ;required for test
>      (list julia-chainrulestestutils julia-finitedifferences julia-nanmath
>            julia-specialfunctions))
>     (propagated-inputs
>      (list julia-chainrulescore julia-compat julia-reexport
>            julia-requires))
> --8<---------------cut here---------------end--------------->8---
>
> but this is somehow bikeshed.  However, the current situation leads to
> non-uniform or ambiguity.
>
> For example, the comments as here:
>
> --8<---------------cut here---------------start------------->8---
>     (inputs
>      (list libx11 libiberty ;needed for objdump support
>            zlib))                       ;also needed for objdump support
> --8<---------------cut here---------------end--------------->8---
Yuck indeed!

> when the comments apply to only one line as it was:
>
> --8<---------------cut here---------------start------------->8---
>      `(("libx11" ,libx11)
>        ("libiberty" ,libiberty)               ;needed for objdump support
>        ("zlib" ,zlib)))                       ;also needed for objdump support
> --8<---------------cut here---------------end--------------->8---
>
> Other said, this looks better:
>
> --8<---------------cut here---------------start------------->8---
>     (inputs
>      (list libx11
>            libiberty ;needed for objdump support
>            zlib))    ;also needed for objdump support
> --8<---------------cut here---------------end--------------->8---
>
> Obviously, we could come up a rule depending on comments, numbers of
> inputs, length, etc.  It was not the case with the old style when
> nothing prevented us to do it.  Because one item per line is, IMHO,
> easier to maintain.

You seem to be putting the cart before the horse here; we should not let
our (lack of) tooling determine our styling preferences.

> Consider the case,
>
>     (inputs
>      (list bar foo1 foo2 foo3 foo3 foo4))
>
> then another ’baz’ inputs is added, do we end with,
>
>     (inputs
>      (list bar foo1 foo2 foo3 foo3 foo4
>            baz))
>
> to minimize and ease reading the diff, or do we end with,
>
>     (inputs
>      (list bar
>            baz
>            foo1
>            foo2
>            foo3
>            foo3
>            foo4))

The second, ideally.

> ?  And the converse is also true, consider the case just above and what
> happens if foo1, foo2 and foo3 are removed.

Everything gets put on a single line again.

> One item per line solves all these boring cosmetic questions.

To be fair, any policy that can be automatically applied solves those
very same boring cosmetic questions. I agree that whatever style we end
up with, we should be able to automatically apply it. 

> Therefore, I propose to always have only one item per line.  To be
> concrete, for one item:
>
>   (inputs
>    (list foo))
>
> or not
>
>   (inputs (list foo))
>
> And for more than one item:
>
>   (inputs
>    (list foo
>          bar))
>
> This would avoid “cosmetic” changes when adding/removing inputs and/or
> comments.

This is not a convincing argument to me; I very much doubt that we have
that many packages that switch back and forth between having <= 4 and >
4 inputs constantly. That is not to say that I think we won't see it
happen; I just don't think it happens often enough to warrant what you
are proposing :-).

> Sadly, it implies another Big Change.  But earlier is better and we
> should do it as soon as possible while the conversion is not totally
> done yet.

I agree, so here's a counter-proposal: adjust the convention and guix
style to leave inputs-with-comments alone. Only put inputs on one line
when there are fewer than N items (configurable, but for now 5), as well
as no comments on any of the lines.

> Cheers,
> simon
>
> 1: <https://guix.gnu.org/en/blog/2021/the-big-change/>
> 2: <https://logs.guix.gnu.org/guix/2021-12-20.log#121156>

- Jelle


  reply	other threads:[~2021-12-22 14:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-22 13:05 Convention for new “guix style“? zimoun
2021-12-22 14:10 ` Jelle Licht [this message]
2021-12-22 15:52   ` zimoun
2021-12-22 19:24     ` André A. Gomes
2021-12-22 17:23 ` Vagrant Cascadian
2021-12-22 17:48   ` Andreas Enge
2021-12-22 21:18 ` Liliana Marie Prikler
2021-12-22 21:17   ` indieterminacy
2021-12-23 10:13     ` Ricardo Wurmus
2021-12-22 21:56   ` zimoun
2022-01-03 15:02 ` Ludovic Courtès
2022-01-03 16:23   ` zimoun
2022-01-03 19:48     ` Leo Famulari
2022-01-03 19:51       ` Leo Famulari
2022-01-03 20:05         ` zimoun
2022-01-05 19:16           ` Leo Famulari

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=86a6gsd91p.fsf@fsfe.org \
    --to=jlicht@fsfe.org \
    --cc=guix-devel@gnu.org \
    --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).