all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Simon Tournier <zimon.toutoune@gmail.com>
Cc: Josselin Poiret <dev@jpoiret.xyz>,
	67489@debbugs.gnu.org, Mathieu Othacehe <othacehe@gnu.org>,
	Tobias Geerinckx-Rice <me@tobias.gr>,
	Ricardo Wurmus <rekado@elephly.net>,
	Christopher Baines <guix@cbaines.net>
Subject: [bug#67489] [PATCH] monad-repl: Add REPL commands to inspect package arguments.
Date: Tue, 28 Nov 2023 17:20:42 +0100	[thread overview]
Message-ID: <871qc9svc5.fsf@gnu.org> (raw)
In-Reply-To: <87a5qycfuk.fsf@gmail.com> (Simon Tournier's message of "Tue, 28 Nov 2023 11:49:39 +0100")

Hello!

Simon Tournier <zimon.toutoune@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’.




  reply	other threads:[~2023-11-28 16:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27 17:19 [bug#67489] [PATCH] monad-repl: Add REPL commands to inspect package arguments Ludovic Courtès
2023-11-28 10:49 ` Simon Tournier
2023-11-28 16:20   ` Ludovic Courtès [this message]
2023-11-28 16:39     ` Simon Tournier
2023-12-04 21:51   ` bug#67489: " Ludovic Courtès

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871qc9svc5.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=67489@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=guix@cbaines.net \
    --cc=me@tobias.gr \
    --cc=othacehe@gnu.org \
    --cc=rekado@elephly.net \
    --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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.