unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Convention for new “guix style“?
@ 2021-12-22 13:05 zimoun
  2021-12-22 14:10 ` Jelle Licht
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: zimoun @ 2021-12-22 13:05 UTC (permalink / raw)
  To: Guix Devel

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

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.


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

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

One item per line solves all these boring cosmetic questions.

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.

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.

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>


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

* Re: Convention for new “guix style“?
  2021-12-22 13:05 Convention for new “guix style“? zimoun
@ 2021-12-22 14:10 ` Jelle Licht
  2021-12-22 15:52   ` zimoun
  2021-12-22 17:23 ` Vagrant Cascadian
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 16+ messages in thread
From: Jelle Licht @ 2021-12-22 14:10 UTC (permalink / raw)
  To: zimoun, Guix Devel

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


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

* Re: Convention for new “guix style“?
  2021-12-22 14:10 ` Jelle Licht
@ 2021-12-22 15:52   ` zimoun
  2021-12-22 19:24     ` André A. Gomes
  0 siblings, 1 reply; 16+ messages in thread
From: zimoun @ 2021-12-22 15:52 UTC (permalink / raw)
  To: Jelle Licht, Guix Devel

Hi Jelle,

We are consistent with what we already said on IRC. ;-)


On Wed, 22 Dec 2021 at 15:10, Jelle Licht <jlicht@fsfe.org> wrote:

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

Therefore, the tool requires a first “exception” for this case.

        (inputs
         (list foo bar
               baz           ;for tests
               bang boum))

The tool already contains an “exception” for this other case.

--8<---------------cut here---------------start------------->8---
        (inputs
         (list julia-chainrulestestutils julia-finitedifferences julia-nanmath
               julia-specialfunctions))
--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.

Hum, I do not know.  Maybe.  For sure, I write my grocery list as:

 + apple
 + orange
 + beer
 + flour

and not,

 apple orange beer flour

but all the flavours are equal. :-)


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

This makes the diffs harder to deal with.  Because one part of the issue
is about comparing revision A with revision B, not just the read the
list at one specific revisin.  Going back and forth to multi and single
line is error-prone, IMHO.

I agree that 1. comparing does not happen so frequently but still, and
2. it does not happen to so many packages but still.

For sure, S-Diff presented by Arun [1] at last FOSDEM 2021 would help.
AFAIK, this kind of tool is not ready for day-to-day usage and not yet
integrated with Git.

1: <https://archive.fosdem.org/2021/schedule/event/sexpressiondiff/>


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

I agree that tools can help.  However, at some point, we effectively
read and the default policy should ease this reading, even with plain
text without any tools.

«Automatically apply it» is not straightforward.  We already have a
great tool “guix lint” and it is not automatically applied.

For sure, I also think that automatic tools is the direction to go, for
sure I want more automation.  And “guix style” is a step toward fixing
Danny’s words:

        FWIW, I do find it strange that Lisp projects, despite using a
        minimal-syntax language (mostly in order to conserve its regular
        tree structure), do not usually automatically format source code
        as they check in, but Go projects, using the prime example of an
        irregular C-like language, DOES usually use code formatters
        automatically when checking in.  That is some strange reversal
        of strengths that I wouldn't have expected.

        <https://yhetil.org/guix/20201204161257.64363a5a@scratchpost.org/>


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

As I am pointing, comment is an issue, obscure diff is another, 4
long-names which splits into 2 lines is another.  These 3 cases are just
things that annoyed me reviewing OCaml update and packaging Julia, after
one week or so using this new style.

(Issue is a strong word for this bikeshed. ;-))


As a good coding style says: «Don't put multiple inputs on a single line
unless you have something to hide». ;-)

However, I do not see the advantages for one line. :-)


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

You are proposing to implement more “rules“. :-) Why not, but it appears
to me a French mindset ;-) add more cases and layers instead of just
simplify with one unique as simple as possible rule.


Cheers,
simon


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

* Re: Convention for new “guix style“?
  2021-12-22 13:05 Convention for new “guix style“? zimoun
  2021-12-22 14:10 ` Jelle Licht
@ 2021-12-22 17:23 ` Vagrant Cascadian
  2021-12-22 17:48   ` Andreas Enge
  2021-12-22 21:18 ` Liliana Marie Prikler
  2022-01-03 15:02 ` Ludovic Courtès
  3 siblings, 1 reply; 16+ messages in thread
From: Vagrant Cascadian @ 2021-12-22 17:23 UTC (permalink / raw)
  To: zimoun, Guix Devel

[-- Attachment #1: Type: text/plain, Size: 667 bytes --]

On 2021-12-22, zimoun wrote:
> 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.

Yes, please! One input per line is simpler to understand, simpler to
implement, and makes for much easier to read diffs, all for the
relatively low cost of a few newlines. :)


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

It might be a big change, but probably wouldn't trigger rebuilds ... ?


live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

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

* Re: Convention for new “guix style“?
  2021-12-22 17:23 ` Vagrant Cascadian
@ 2021-12-22 17:48   ` Andreas Enge
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas Enge @ 2021-12-22 17:48 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: Guix Devel

Am Wed, Dec 22, 2021 at 09:23:33AM -0800 schrieb Vagrant Cascadian:
> It might be a big change, but probably wouldn't trigger rebuilds ... ?

No, it would only change the source code; I am all for it!

Andreas



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

* Re: Convention for new “guix style“?
  2021-12-22 15:52   ` zimoun
@ 2021-12-22 19:24     ` André A. Gomes
  0 siblings, 0 replies; 16+ messages in thread
From: André A. Gomes @ 2021-12-22 19:24 UTC (permalink / raw)
  To: zimoun; +Cc: Guix Devel

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

> And “guix style” is a step toward fixing Danny’s words:
>
>         FWIW, I do find it strange that Lisp projects, despite using a
>         minimal-syntax language (mostly in order to conserve its regular
>         tree structure), do not usually automatically format source code
>         as they check in, but Go projects, using the prime example of an
>         irregular C-like language, DOES usually use code formatters
>         automatically when checking in.  That is some strange reversal
>         of strengths that I wouldn't have expected.
>
>         <https://yhetil.org/guix/20201204161257.64363a5a@scratchpost.org/>

I agree and disagree.

(Disagree).  Lisps hardly ever need external formaters or linters since
you basically write down an AST.  The "linting" job is done by the
editor itself (think C-M-q and electrical indentation in major modes).
Yes, there is ambiguity in some cases, but the decision is (rightly)
left to the programmer.  I believe that it's precisely the lack of
"structure" in other languages that motivates the need for such tooling.

(Agree).  If we turn to the concrete issue at hand, cosmetic and "diff"
issues of Guix packages, then I agree that this would (ideally) be a
task for a tool (guix lint).  Because it's important to have consistency
and we can agree on the standards.  I'm arguing that in this case the
ambiguity (mentioned above) vanishes, and so the style can be enforced.

When I go shopping, I write the list down in same way you do, Zimoun :)


-- 
André A. Gomes
"Free Thought, Free World"


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

* Re: Convention for new “guix style“?
  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
  1 sibling, 1 reply; 16+ messages in thread
From: indieterminacy @ 2021-12-22 21:17 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: guix-devel

I wonder if there has been any progress made by Arun Isaac with his program, Semantically meaningful S-expression diff

https://archive.fosdem.org/2021/schedule/event/sexpressiondiff/

```
Traditional diff implementations, such as GNU Diff, treat files as a
flat list of lines. A tree-diff algorithm that can produce minimal and
semantically meaningful output is a surprisingly more difficult and
complex problem. In fact, for unordered trees, the problem is NP-hard.
```


Jonathan

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Hi,
>
> Am Mittwoch, dem 22.12.2021 um 14:05 +0100 schrieb zimoun:
>> [...]
>> --8<---------------cut here---------------start------------->8---
>>     (inputs
>>      (list libx11 libiberty ;needed for objdump support
>>            zlib))                       ;also needed for objdump
>> support
>> --8<---------------cut here---------------end--------------->8---
>> 
>> 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.
> For me personally, this illustrates two things.  First, the weakness of
> line comments over preceding line comments ad second the verbosity of
> old input style.  You could easily write 
>   (list libiberty zlib) ; for objdump
> in the new style, which you couldn't before.  Therefore, I wouldn't
> mandate a "one line per input" restriction, as the only reason it was
> ever imposed was a historical limitation.
>
>> 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))
>> 
>> ?  And the converse is also true, consider the case just above and
>> what
>> happens if foo1, foo2 and foo3 are removed.
>> 
>> One item per line solves all these boring cosmetic questions.
>> 
>> 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.
> In my personal opinion, everything else being equal, changes to
> inputs/native-inputs/propagated-inputs should (almost) always be seen
> as changes to the field, as would be documented in the ChangeLog.
>
> I think the usual scheme coding guidelines also apply well to inputs,
> e.g. inline short stuff, but don't do funky things when the lines grow
> unnecessarily long.
>
> Now I am putting aside the issue of tooling here, because I think that
> humans ought to be able to look at the diff and see that something's
> wrong and correct it, but as others point out an "I don't touch
> comments" approach would be very fine by me.
>
> Cheers



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

* Re: Convention for new “guix style“?
  2021-12-22 13:05 Convention for new “guix style“? zimoun
  2021-12-22 14:10 ` Jelle Licht
  2021-12-22 17:23 ` Vagrant Cascadian
@ 2021-12-22 21:18 ` Liliana Marie Prikler
  2021-12-22 21:17   ` indieterminacy
  2021-12-22 21:56   ` zimoun
  2022-01-03 15:02 ` Ludovic Courtès
  3 siblings, 2 replies; 16+ messages in thread
From: Liliana Marie Prikler @ 2021-12-22 21:18 UTC (permalink / raw)
  To: zimoun, Guix Devel

Hi,

Am Mittwoch, dem 22.12.2021 um 14:05 +0100 schrieb zimoun:
> [...]
> --8<---------------cut here---------------start------------->8---
>     (inputs
>      (list libx11 libiberty ;needed for objdump support
>            zlib))                       ;also needed for objdump
> support
> --8<---------------cut here---------------end--------------->8---
> 
> 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.
For me personally, this illustrates two things.  First, the weakness of
line comments over preceding line comments ad second the verbosity of
old input style.  You could easily write 
  (list libiberty zlib) ; for objdump
in the new style, which you couldn't before.  Therefore, I wouldn't
mandate a "one line per input" restriction, as the only reason it was
ever imposed was a historical limitation.

> 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))
> 
> ?  And the converse is also true, consider the case just above and
> what
> happens if foo1, foo2 and foo3 are removed.
> 
> One item per line solves all these boring cosmetic questions.
> 
> 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.
In my personal opinion, everything else being equal, changes to
inputs/native-inputs/propagated-inputs should (almost) always be seen
as changes to the field, as would be documented in the ChangeLog.

I think the usual scheme coding guidelines also apply well to inputs,
e.g. inline short stuff, but don't do funky things when the lines grow
unnecessarily long.

Now I am putting aside the issue of tooling here, because I think that
humans ought to be able to look at the diff and see that something's
wrong and correct it, but as others point out an "I don't touch
comments" approach would be very fine by me.

Cheers


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

* Re: Convention for new “guix style“?
  2021-12-22 21:18 ` Liliana Marie Prikler
  2021-12-22 21:17   ` indieterminacy
@ 2021-12-22 21:56   ` zimoun
  1 sibling, 0 replies; 16+ messages in thread
From: zimoun @ 2021-12-22 21:56 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: Guix Devel

Hi,

On Wed, 22 Dec 2021 at 22:18, Liliana Marie Prikler
<liliana.prikler@gmail.com> wrote:
> Am Mittwoch, dem 22.12.2021 um 14:05 +0100 schrieb zimoun:

> > --8<---------------cut here---------------start------------->8---
> >      `(("libx11" ,libx11)
> >        ("libiberty" ,libiberty)               ;needed for objdump
> >        ("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---

[...]

> For me personally, this illustrates two things.  First, the weakness of
> line comments over preceding line comments ad second the verbosity of
> old input style.  You could easily write
>
>   (list libiberty zlib) ; for objdump

What about 'libx11'?   Otherwise, you end with cons (append for some
cases) or something along these lines,

    (inputs
      (cons
         libx11
         (list libiberty zlib))) ;for objdump

I am not convinced it is better...

> in the new style, which you couldn't before.  Therefore, I wouldn't

Yes, I could do it in the old style:

      `(("libx11" ,libx11)
        ("libiberty" ,libiberty) ("zlib" ,zlib)))  ;for objdump support

I have never read such thing.  And I miss your point because from my
understanding, it is not related to old style (list using labels)
versus new style (just list).

> mandate a "one line per input" restriction, as the only reason it was
> ever imposed was a historical limitation.

I miss your comment here.  It is possible to write

    (inputs `(("foo" ,bar) ("baz" ,done)))

and I have not done stats but I guess the rule for old style is: one
item per line whatever the numbers, comments or length.  Because, I
guess again, readibility matters. :-)


> > This would avoid “cosmetic” changes when adding/removing inputs
> > and/or comments.
>
> In my personal opinion, everything else being equal, changes to
> inputs/native-inputs/propagated-inputs should (almost) always be seen
> as changes to the field, as would be documented in the ChangeLog.
>
> I think the usual scheme coding guidelines also apply well to inputs,
> e.g. inline short stuff, but don't do funky things when the lines grow
> unnecessarily long.

If that argument holds, then why is it not applied for old style? ;-)

We do not read,

--8<---------------cut here---------------start------------->8---
    (native-inputs
     `(("pkg-config" ,pkg-config) ("python" ,python-wrapper)))
--8<---------------cut here---------------end--------------->8---

for gnu/packages/video.scm (mediasdk) as example.


Cheers,
simon


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

* Re: Convention for new “guix style“?
  2021-12-22 21:17   ` indieterminacy
@ 2021-12-23 10:13     ` Ricardo Wurmus
  0 siblings, 0 replies; 16+ messages in thread
From: Ricardo Wurmus @ 2021-12-23 10:13 UTC (permalink / raw)
  To: indieterminacy; +Cc: guix-devel, Liliana Marie Prikler


indieterminacy@libre.brussels writes:

> I wonder if there has been any progress made by Arun Isaac with his program, Semantically meaningful S-expression diff
>
> https://archive.fosdem.org/2021/schedule/event/sexpressiondiff/

There’s also ydiff[1].  Unfortunately, it only produces an HTML file as
output, so it cannot be used as a diff program with git.

[1]: https://github.com/yinwang0/ydiff

-- 
Ricardo


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

* Re: Convention for new “guix style“?
  2021-12-22 13:05 Convention for new “guix style“? zimoun
                   ` (2 preceding siblings ...)
  2021-12-22 21:18 ` Liliana Marie Prikler
@ 2022-01-03 15:02 ` Ludovic Courtès
  2022-01-03 16:23   ` zimoun
  3 siblings, 1 reply; 16+ messages in thread
From: Ludovic Courtès @ 2022-01-03 15:02 UTC (permalink / raw)
  To: zimoun; +Cc: Guix Devel

Hello from 2022!

I missed the bikeshedding discussion last year.  :-)

I think we can tweak style as we go, and it’s okay to have variants
around the same style IMO, but I’m against the idea of rewriting the
whole repo every time we have a new idea of what things should look
like.  This one was very much one-shot.

When doing the first iterations of ‘guix style’¹, I found it more
pleasant to the eye to have small lists on a single line, the prime
example being:

  (native-inputs
    (list autoconf automake libtool pkg-config))

Diffs of such a list remain readable IMO.  I do agree that for longer
lists one item per line is clearer though, which is why the pretty
printer has this #:long-list parameter, currently defaulting to 5.

There’s an opportunity to discuss style with new ‘guix style’ changes².
However, care must be taken not to fall into the bikeshedding trap.  I
think we must aim for readability and consistency, but also acknowledge
that there’ll always be circumstances where one might choose a slightly
different stylistic variant and that up to a certain level those
variants are entirely fine.  In the end ‘guix style’ is a helper; human
beings get the last say.

Thanks,
Ludo’.

¹ https://issues.guix.gnu.org/49169
² https://issues.guix.gnu.org/52974


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

* Re: Convention for new “guix style“?
  2022-01-03 15:02 ` Ludovic Courtès
@ 2022-01-03 16:23   ` zimoun
  2022-01-03 19:48     ` Leo Famulari
  0 siblings, 1 reply; 16+ messages in thread
From: zimoun @ 2022-01-03 16:23 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix Devel

Hi Ludo,

On Mon, 03 Jan 2022 at 16:02, Ludovic Courtès <ludo@gnu.org> wrote:

> When doing the first iterations of ‘guix style’¹, I found it more
> pleasant to the eye to have small lists on a single line, the prime
> example being:
>
>   (native-inputs
>     (list autoconf automake libtool pkg-config))
>
> Diffs of such a list remain readable IMO.  I do agree that for longer
> lists one item per line is clearer though, which is why the pretty
> printer has this #:long-list parameter, currently defaulting to 5.
>
> There’s an opportunity to discuss style with new ‘guix style’ changes².
> However, care must be taken not to fall into the bikeshedding trap.  I
> think we must aim for readability and consistency, but also acknowledge
> that there’ll always be circumstances where one might choose a slightly
> different stylistic variant and that up to a certain level those
> variants are entirely fine.  In the end ‘guix style’ is a helper; human
> beings get the last say.

Well, I disagree.  But yeah, as you said elsewhere 1) the proposal had
been done more than 6 months ago so I had time to wake up and raise and
2) let avoid to fall into the Walder’s law; as exposed by the excellent
food for thought video [1] you pointed [2].

Cheers,
simon


1: <https://www.youtube.com/watch?v=T1t4zGJYUuY>
2: <https://yhetil.org/guix/87ee641w3e.fsf@inria.fr>


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

* Re: Convention for new “guix style“?
  2022-01-03 16:23   ` zimoun
@ 2022-01-03 19:48     ` Leo Famulari
  2022-01-03 19:51       ` Leo Famulari
  0 siblings, 1 reply; 16+ messages in thread
From: Leo Famulari @ 2022-01-03 19:48 UTC (permalink / raw)
  To: zimoun; +Cc: Guix Devel

On Mon, Jan 03, 2022 at 05:23:22PM +0100, zimoun wrote:
> Well, I disagree.  But yeah, as you said elsewhere 1) the proposal had
> been done more than 6 months ago so I had time to wake up and raise and
> 2) let avoid to fall into the Walder’s law; as exposed by the excellent
> food for thought video [1] you pointed [2].

Can you summarize Walder's law? I don't have time to watch that video.


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

* Re: Convention for new “guix style“?
  2022-01-03 19:48     ` Leo Famulari
@ 2022-01-03 19:51       ` Leo Famulari
  2022-01-03 20:05         ` zimoun
  0 siblings, 1 reply; 16+ messages in thread
From: Leo Famulari @ 2022-01-03 19:51 UTC (permalink / raw)
  To: zimoun; +Cc: Guix Devel

On Mon, Jan 03, 2022 at 02:48:27PM -0500, Leo Famulari wrote:
> On Mon, Jan 03, 2022 at 05:23:22PM +0100, zimoun wrote:
> > Well, I disagree.  But yeah, as you said elsewhere 1) the proposal had
> > been done more than 6 months ago so I had time to wake up and raise and
> > 2) let avoid to fall into the Walder’s law; as exposed by the excellent
> > food for thought video [1] you pointed [2].
> 
> Can you summarize Walder's law? I don't have time to watch that video.

Never mind, I see that it's Wadler's law:

------
In any language design, the total time spent discussing
a feature in this list is proportional to two raised to
the power of its position.
     0. Semantics
     1. Syntax
     2. Lexical syntax
     3. Lexical syntax of comments
------


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

* Re: Convention for new “guix style“?
  2022-01-03 19:51       ` Leo Famulari
@ 2022-01-03 20:05         ` zimoun
  2022-01-05 19:16           ` Leo Famulari
  0 siblings, 1 reply; 16+ messages in thread
From: zimoun @ 2022-01-03 20:05 UTC (permalink / raw)
  To: Leo Famulari; +Cc: Guix Devel

Hi Leo,

On Mon, 03 Jan 2022 at 14:51, Leo Famulari <leo@famulari.name> wrote:

>> Can you summarize Walder's law? I don't have time to watch that video.
>
> Never mind, I see that it's Wadler's law:
>
> ------
> In any language design, the total time spent discussing
> a feature in this list is proportional to two raised to
> the power of its position.
>      0. Semantics
>      1. Syntax
>      2. Lexical syntax
>      3. Lexical syntax of comments
> ------

The video refers to:

--8<---------------cut here---------------start------------->8---
        The emotional intensity of debate on a language feature
        increases as one moves down the following scale:
            Semantics,
            Syntax,
            Lexical syntax,
            Comments.
--8<---------------cut here---------------end--------------->8---

<https://youtu.be/T1t4zGJYUuY?t=553>

BTW, I hope you will be able to schedule some time to watch this video.
It provides some points that appears to me being really worth to
consider when we speak about «Grow a Community».  Rust is not a model
to bootstrap a compiler but the community structure seems great. :-)


Cheers,
simon


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

* Re: Convention for new “guix style“?
  2022-01-03 20:05         ` zimoun
@ 2022-01-05 19:16           ` Leo Famulari
  0 siblings, 0 replies; 16+ messages in thread
From: Leo Famulari @ 2022-01-05 19:16 UTC (permalink / raw)
  To: zimoun; +Cc: Guix Devel

On Mon, Jan 03, 2022 at 09:05:00PM +0100, zimoun wrote:
> BTW, I hope you will be able to schedule some time to watch this video.
> It provides some points that appears to me being really worth to
> consider when we speak about «Grow a Community».  Rust is not a model
> to bootstrap a compiler but the community structure seems great. :-)

I definitely agree with the overall initiative of improving the Guix
community. But I'm already working, as a volunteer, at the limit of my
motivation and my ability.


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

end of thread, other threads:[~2022-01-05 19:24 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-22 13:05 Convention for new “guix style“? zimoun
2021-12-22 14:10 ` Jelle Licht
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

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