unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#56297: Guix style imperfections
@ 2022-06-29  9:33 Maxime Devos
  2022-06-29 10:15 ` Liliana Marie Prikler
  2022-07-02 10:11 ` Ludovic Courtès
  0 siblings, 2 replies; 9+ messages in thread
From: Maxime Devos @ 2022-06-29  9:33 UTC (permalink / raw)
  To: 56297

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

Hi,

"guix style" occasionally makes some decision that seem a bit
questionable to me.  More concretely, copy the definition of guile-
next, put it in a .scm and rename it, and run
"guix style -L . guile-next-styleme".  I get:

> (define-module (test))
> (use-modules (guix packages) (guix git-download) (gnu packages autotools) (gnu packages guile) (guix utils)
> (define-public guile-next
>  (let ((version "3.0.7") (revision "0")
>        (commit "d70c1dbebf9ac0fd45af4578c23983ec4a7da535"))

Conventionally 'revision' is put on another line -- for these kind of let bindings,
(maybe all?), I would recommend to put all of them on separate lines.

>    (package
>      (inherit guile-3.0)
>      (name "guile-next-styleme")
>      (version (git-version version revision commit))
>      (source [snip, LGTM])
>      (arguments
>       (substitute-keyword-arguments (package-arguments guile-3.0)
>         ((#:phases phases
>           '%standard-phases) `(modify-phases ,phases

Put %standard-phases on the same line ad #:phases phases and `(modify-phases ,phases
on a new lineg 
>                                 (add-before 'check 'skip-failing-tests
>                                   (lambda _
>                                     (substitute* "test-suite/standalone/test-out-of-memory"
>                                       (("!#") "!#
>
>(exit 77)
>"))

I'd prefer the original "!#\n\n(exit 77)\n" here, but I don't know if that's
something 'Guix style' could feasibly do (there might be situations where a
newline might be appropriate, how could "guix style" which is the case?).

>                                     (delete-file
>                                      "test-suite/tests/version.test") #t))))))

(Would be nice if "guix style" could be taught to remove those #t, but that seems
more a feature limitation than a bug to me.)

>      (native-inputs (modify-inputs (package-native-inputs guile-3.0)
>                       (prepend autoconf
>                                automake
>                                libtool
>                                flex
>                                gnu-gettext
>                                texinfo
>                                gperf)))

I'd consider it tidier to put (modify-inputs ...) on a new line

>     (synopsis "Development version of GNU Guile"))))

Question: do people agree with these style choices?

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* bug#56297: Guix style imperfections
  2022-06-29  9:33 bug#56297: Guix style imperfections Maxime Devos
@ 2022-06-29 10:15 ` Liliana Marie Prikler
  2022-06-29 10:18   ` Maxime Devos
  2022-06-29 10:19   ` Maxime Devos
  2022-07-02 10:11 ` Ludovic Courtès
  1 sibling, 2 replies; 9+ messages in thread
From: Liliana Marie Prikler @ 2022-06-29 10:15 UTC (permalink / raw)
  To: Maxime Devos, 56297

Am Mittwoch, dem 29.06.2022 um 11:33 +0200 schrieb Maxime Devos:
> Hi,
> 
> "guix style" occasionally makes some decision that seem a bit
> questionable to me.  More concretely, copy the definition of guile-
> next, put it in a .scm and rename it, and run
> "guix style -L . guile-next-styleme".  I get:
Before commenting on the individual points, I do think in general guix
style needs to have a "lax" mode and a "strict" mode where the latter
is enabled via "--strict" and keeps certain snippets as-is.  All
elements that save vertical space at the cost of horizontal space
should be disabled in strict mode, whereas they might be acceptable in
lax mode.

> > (define-module (test))
> > (use-modules (guix packages) (guix git-download) (gnu packages
> > autotools) (gnu packages guile) (guix utils)
> > (define-public guile-next
> >  (let ((version "3.0.7") (revision "0")
> >        (commit "d70c1dbebf9ac0fd45af4578c23983ec4a7da535"))
> 
> Conventionally 'revision' is put on another line -- for these kind of
> let bindings, (maybe all?), I would recommend to put all of them on
> separate lines.
Agree.

> >    (package
> >      (inherit guile-3.0)
> >      (name "guile-next-styleme")
> >      (version (git-version version revision commit))
> >      (source [snip, LGTM])
> >      (arguments
> >       (substitute-keyword-arguments (package-arguments guile-3.0)
> >         ((#:phases phases
> >           '%standard-phases) `(modify-phases ,phases
> 
> Put %standard-phases on the same line ad #:phases phases and `(modify-
> phases ,phases on a new line
Agree.  What's even the point the current style tries to make?

> >                                 (add-before 'check 'skip-failing-
> > tests
> >                                   (lambda _
> >                                     (substitute* "test-
> > suite/standalone/test-out-of-memory"
> >                                       (("!#") "!#
> > 
> > (exit 77)
> > "))
> 
> I'd prefer the original "!#\n\n(exit 77)\n" here, but I don't know if
> that's something 'Guix style' could feasibly do (there might be
> situations where a newline might be appropriate, how could "guix style"
> which is the case?).
I'd prefer if strict mode typed those out, but we can keep strings "as-
is" in lax mode, supposing they don't grow beyond the horizontal limit.

> >                                     (delete-file
> >                                      "test-suite/tests/version.test")
> > #t))))))
> 
> (Would be nice if "guix style" could be taught to remove those #t, but
> that seems more a feature limitation than a bug to me.)
It can still do better by not contracting them imho.

> >      (native-inputs (modify-inputs (package-native-inputs guile-3.0)
> >                       (prepend autoconf
> >                                automake
> >                                libtool
> >                                flex
> >                                gnu-gettext
> >                                texinfo
> >                                gperf)))
> 
> I'd consider it tidier to put (modify-inputs ...) on a new line
Here, it depends.  I think I'd write this as 

     (native-inputs 
       (modify-inputs (package-native-inputs guile-3.0)
         (prepend autoconf automake libtool
                  flex gperf
                  gnu-gettext texinfo)))

> >     (synopsis "Development version of GNU Guile"))))
> 
> Question: do people agree with these style choices?
I think some people might actually be okay with a few or even all of
them (juding by how many submit collapsed lets), but I'd like to point
out that they break with Lisp coding guidelines for no good reason.

Regarding the optimization of vertical space, I do think that guix
lacks semantic information to make meaningful choices and thus ought to
either step back when an "informed" user invokes the tool or strictly
take the "least optimal, but correct" approach in strict mode.

Cheers




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

* bug#56297: Guix style imperfections
  2022-06-29 10:15 ` Liliana Marie Prikler
@ 2022-06-29 10:18   ` Maxime Devos
  2022-06-29 10:20     ` Liliana Marie Prikler
  2022-06-29 10:19   ` Maxime Devos
  1 sibling, 1 reply; 9+ messages in thread
From: Maxime Devos @ 2022-06-29 10:18 UTC (permalink / raw)
  To: Liliana Marie Prikler, 56297

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

Liliana Marie Prikler schreef op wo 29-06-2022 om 12:15 [+0200]:
> Here, it depends.  I think I'd write this as 
> 
>      (native-inputs 
>        (modify-inputs (package-native-inputs guile-3.0)
>          (prepend autoconf automake libtool
>                   flex gperf
>                   gnu-gettext texinfo)))

FWIW, I was thinking of

   (native-inputs
     (modify-inputs [...]
       (prepend autoconf
                automake
                libtool
                flex gperf
                gnu-gettext
                texinfo)))

, I haven't really thought about putting multiple inputs on a single
line myself.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* bug#56297: Guix style imperfections
  2022-06-29 10:15 ` Liliana Marie Prikler
  2022-06-29 10:18   ` Maxime Devos
@ 2022-06-29 10:19   ` Maxime Devos
  2022-06-29 10:25     ` Liliana Marie Prikler
  1 sibling, 1 reply; 9+ messages in thread
From: Maxime Devos @ 2022-06-29 10:19 UTC (permalink / raw)
  To: Liliana Marie Prikler, 56297

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

Liliana Marie Prikler schreef op wo 29-06-2022 om 12:15 [+0200]:
> > >                                     (delete-file
> > >                                      "test-
> > > suite/tests/version.test")
> > > #t))))))
> > 
> > (Would be nice if "guix style" could be taught to remove those #t,
> > but
> > that seems more a feature limitation than a bug to me.)
> It can still do better by not contracting them imho.

TBC, do you mean doing #t -> #true, #f -> #false?

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* bug#56297: Guix style imperfections
  2022-06-29 10:18   ` Maxime Devos
@ 2022-06-29 10:20     ` Liliana Marie Prikler
  0 siblings, 0 replies; 9+ messages in thread
From: Liliana Marie Prikler @ 2022-06-29 10:20 UTC (permalink / raw)
  To: Maxime Devos, 56297

Am Mittwoch, dem 29.06.2022 um 12:18 +0200 schrieb Maxime Devos:
> Liliana Marie Prikler schreef op wo 29-06-2022 om 12:15 [+0200]:
> > Here, it depends.  I think I'd write this as 
> > 
> >      (native-inputs 
> >        (modify-inputs (package-native-inputs guile-3.0)
> >          (prepend autoconf automake libtool
> >                   flex gperf
> >                   gnu-gettext texinfo)))
> 
> FWIW, I was thinking of
> 
>    (native-inputs
>      (modify-inputs [...]
>        (prepend autoconf
>                 automake
>                 libtool
>                 flex gperf
>                 gnu-gettext
>                 texinfo)))
> 
> , I haven't really thought about putting multiple inputs on a single
> line myself.
That ought to be the strict suggestion; the variant I posted above
should simply be seen as "acceptable" in lax mode for not breaking the
horizontal space limit.




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

* bug#56297: Guix style imperfections
  2022-06-29 10:19   ` Maxime Devos
@ 2022-06-29 10:25     ` Liliana Marie Prikler
  0 siblings, 0 replies; 9+ messages in thread
From: Liliana Marie Prikler @ 2022-06-29 10:25 UTC (permalink / raw)
  To: Maxime Devos, 56297

Am Mittwoch, dem 29.06.2022 um 12:19 +0200 schrieb Maxime Devos:
> Liliana Marie Prikler schreef op wo 29-06-2022 om 12:15 [+0200]:
> > > >                                     (delete-file
> > > >                                      "test-
> > > > suite/tests/version.test")
> > > > #t))))))
> > > 
> > > (Would be nice if "guix style" could be taught to remove those
> > > #t,
> > > but
> > > that seems more a feature limitation than a bug to me.)
> > It can still do better by not contracting them imho.
> 
> TBC, do you mean doing #t -> #true, #f -> #false?
I mean leaving them on an extra line.  The current style tool mostly
errs when contracting multiple lines, which imho should not be its
task.

The problem that is solved here, is that people sometimes (particularly
in the uri field of the source) make these contractions for style
reasons.  Guix style, having been taught that, tries to extrapolate
this to all fields.

Cheers





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

* bug#56297: Guix style imperfections
  2022-06-29  9:33 bug#56297: Guix style imperfections Maxime Devos
  2022-06-29 10:15 ` Liliana Marie Prikler
@ 2022-07-02 10:11 ` Ludovic Courtès
  2022-07-04 21:41   ` Ludovic Courtès
  1 sibling, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2022-07-02 10:11 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 56297

Hi,

Maxime Devos <maximedevos@telenet.be> skribis:

> "guix style" occasionally makes some decision that seem a bit
> questionable to me.

Let’s keep in mind that some are bugs/limitations that can be fixed,
while others cannot really be addressed because our tastes vary
depending on context and the pretty printer could hardly be made smart
enough to distinguish all the subtleties.

>> (define-public guile-next
>>  (let ((version "3.0.7") (revision "0")
>>        (commit "d70c1dbebf9ac0fd45af4578c23983ec4a7da535"))
>
> Conventionally 'revision' is put on another line -- for these kind of let bindings,
> (maybe all?), I would recommend to put all of them on separate lines.

This one is a bug IMO: ‘let’ bindings should be treated specially, and
currently they’re not.

>>       (substitute-keyword-arguments (package-arguments guile-3.0)
>>         ((#:phases phases
>>           '%standard-phases) `(modify-phases ,phases
>
> Put %standard-phases on the same line ad #:phases phases and `(modify-phases ,phases
> on a new lineg 

OK.

>>                                 (add-before 'check 'skip-failing-tests
>>                                   (lambda _
>>                                     (substitute* "test-suite/standalone/test-out-of-memory"
>>                                       (("!#") "!#
>>
>>(exit 77)
>>"))
>
> I'd prefer the original "!#\n\n(exit 77)\n" here, but I don't know if that's
> something 'Guix style' could feasibly do (there might be situations where a
> newline might be appropriate, how could "guix style" which is the case?).

Exactly: in synopses/descriptions, we do want to print newlines as-is
(see ‘tests/style.scm’).

Perhaps we could come up with heuristics that make different choices
depending on context, but that sounds tricky.

>>                                     (delete-file
>>                                      "test-suite/tests/version.test") #t))))))
>
> (Would be nice if "guix style" could be taught to remove those #t, but that seems
> more a feature limitation than a bug to me.)

That could be the job of a different style rule (the ‘-S’ option).

>>      (native-inputs (modify-inputs (package-native-inputs guile-3.0)
>>                       (prepend autoconf
>>                                automake
>>                                libtool
>>                                flex
>>                                gnu-gettext
>>                                texinfo
>>                                gperf)))
>
> I'd consider it tidier to put (modify-inputs ...) on a new line

Dunno it’s a matter of taste.  :-)

Ludo’.




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

* bug#56297: Guix style imperfections
  2022-07-02 10:11 ` Ludovic Courtès
@ 2022-07-04 21:41   ` Ludovic Courtès
  2022-07-19 13:40     ` Maxime Devos
  0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2022-07-04 21:41 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 56297

Hi,

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

>>> (define-public guile-next
>>>  (let ((version "3.0.7") (revision "0")
>>>        (commit "d70c1dbebf9ac0fd45af4578c23983ec4a7da535"))
>>
>> Conventionally 'revision' is put on another line -- for these kind of let bindings,
>> (maybe all?), I would recommend to put all of them on separate lines.
>
> This one is a bug IMO: ‘let’ bindings should be treated specially, and
> currently they’re not.

Commit 8d9291bd2c36810be50ea340cefa481a42c60a2b fixes this, and…

>>>       (substitute-keyword-arguments (package-arguments guile-3.0)
>>>         ((#:phases phases
>>>           '%standard-phases) `(modify-phases ,phases
>>
>> Put %standard-phases on the same line ad #:phases phases and `(modify-phases ,phases
>> on a new lineg 

… the second part of this one.

Ludo’.




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

* bug#56297: Guix style imperfections
  2022-07-04 21:41   ` Ludovic Courtès
@ 2022-07-19 13:40     ` Maxime Devos
  0 siblings, 0 replies; 9+ messages in thread
From: Maxime Devos @ 2022-07-19 13:40 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 56297

Ludovic Courtès schreef op ma 04-07-2022 om 23:41 [+0200]:
> 
> Commit 8d9291bd2c36810be50ea340cefa481a42c60a2b fixes this [...]

Some issues remain, but nice!




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

end of thread, other threads:[~2022-07-19 14:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29  9:33 bug#56297: Guix style imperfections Maxime Devos
2022-06-29 10:15 ` Liliana Marie Prikler
2022-06-29 10:18   ` Maxime Devos
2022-06-29 10:20     ` Liliana Marie Prikler
2022-06-29 10:19   ` Maxime Devos
2022-06-29 10:25     ` Liliana Marie Prikler
2022-07-02 10:11 ` Ludovic Courtès
2022-07-04 21:41   ` Ludovic Courtès
2022-07-19 13:40     ` Maxime Devos

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