unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@ist.tugraz.at>
To: Maxime Devos <maximedevos@telenet.be>, 56297@debbugs.gnu.org
Subject: bug#56297: Guix style imperfections
Date: Wed, 29 Jun 2022 12:15:02 +0200	[thread overview]
Message-ID: <1d570330e9811ec9327ec4f99e2baed4fd922194.camel@ist.tugraz.at> (raw)
In-Reply-To: <9499300db3fe4222f7126240fb2acad3cdf4371b.camel@telenet.be>

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




  reply	other threads:[~2022-06-29 10:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-29  9:33 bug#56297: Guix style imperfections Maxime Devos
2022-06-29 10:15 ` Liliana Marie Prikler [this message]
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

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=1d570330e9811ec9327ec4f99e2baed4fd922194.camel@ist.tugraz.at \
    --to=liliana.prikler@ist.tugraz.at \
    --cc=56297@debbugs.gnu.org \
    --cc=maximedevos@telenet.be \
    /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).