GNU bug report logs - #67489
[PATCH] monad-repl: Add REPL commands to inspect package arguments.

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Mon, 27 Nov 2023 17:21:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 67489 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Simon Tournier <zimon.toutoune <at> gmail.com>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, 67489 <at> debbugs.gnu.org,
 Mathieu Othacehe <othacehe <at> gnu.org>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Ricardo Wurmus <rekado <at> elephly.net>, Christopher Baines <guix <at> cbaines.net>
Subject: Re: [bug#67489] [PATCH] monad-repl: Add REPL commands to inspect
 package arguments.
Date: Tue, 28 Nov 2023 17:20:42 +0100
Hello!

Simon Tournier <zimon.toutoune <at> gmail.com> skribis:

> TLDR: All LGTM. :-)

Thanks.  :-)

> scheme@(guix-user)> ,pp (cdr (memq #:phases (package-arguments cava)))
> $3 = (#<gexp (modify-phases %standard-phases (replace (quote bootstrap) (lambda _ (setenv "HOME" (getcwd)) (invoke "sh" "autogen.sh"))) (add-before (quote build) (quote make-cava-ldflags) (lambda _ (mkdir-p (string-append #<gexp-output out> "/lib")))) (add-after (quote install) (quote data) (lambda _ (for-each (lambda (file) (install-file file (string-append #<gexp-output out> "/share/doc/examples"))) (find-files "example_files"))))) gnu/packages/audio.scm:5161:11 7f7258403a50>)
>
>
> Without drifting, why not the meta-command ,arguments? 

One can already do “,pp (package-arguments package)”, so I wanted to
have something short and to-the-point that would improve on that.

In particular, we know by convention that certain arguments can be
interpreted as code (gexps or sexps) so we can process them do display
them in a nice way (lowering gexps, applying the pretty printer).  We
cannot necessarily do that for other arguments where there’s no
established convention.

These REPL commands are really tailored for packagers.

> Here all is clear.  What can be confusing is the expansion of #$output
> as ((@ (guile) getenv) "out").  Maybe it could be worth to document this
> under G-expression section.  Or provide a similar example using
> G-expression under the section G-expression.
>
> Well, that’s unrelated to this patch and could be done separately. :-)

Yeah, we could/should document the implementation of #$output.

> Out of curiosity, what is the advantage for #:autoload versus
> #:use-module + #:select?

#:autoload allows modules to be loaded lazily, the first time one of the
selected symbols is used.  It’s a way to reduce startup time (equivalent
to Emacs autoloads).

>> +(define (keyword-argument-value args keyword default)
>> +  "Return the value associated with KEYWORD in ARGS, a keyword/value sequence,
>> +or DEFAULT if KEYWORD is missing from ARGS."
>> +  (let loop ((args args))
>> +    (match args
>> +      (()
>> +       default)
>> +      ((kw value rest ...)
>> +       (if (eq? kw keyword)
>> +           value
>> +           (loop rest))))))
>
>     ( Aside.  Each time, I am surprised that common helpers are not
>        Guile builtins, here for extracting keyword value.  It would help
>        Guile to provide such builtin, by default or via some ice-9
>        module.

Yeah, I was disappointed too.  :-)  (ice-9 optargs) has helpers that
weren’t a good match.

Thanks for your feedback!

Ludo’.




This bug report was last modified 1 year and 248 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.