all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 39945@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#39945] [PATCH 0/1] Introducing 'with-parameters' for gexp dynamic binding
Date: Fri,  6 Mar 2020 11:41:08 +0100	[thread overview]
Message-ID: <20200306104108.19503-1-ludo@gnu.org> (raw)

Hello Guix!

This patch adds a new ‘with-parameters’ form.  It is like ‘parameterize’
except that it takes effect when a file-like object is lowered, as in:

  ;; Return coreutils for i686.
  (with-parameters ((%current-system "i686-linux"))
    coreutils)

‘with-parameters’ is necessary because if you would use ‘parameterize’
in the example above, it wouldn’t have any effect at all: the dynamic
binding would be installed at the wrong time.

It works for any SRFI-39 parameter, though ‘%current-system’ is my main
use case.  It makes it possible to have gexps or manifests that include
things explicitly targeting a given system.  (For instance, I’d like to
have a manifest for release-critical things that explicitly pins the
targeted systems.)

Note that ‘with-parameters’ applies to file-like objects; it is _not_ a
property of the gexp itself.  So one cannot, for example, write:

  (with-parameters ((%current-system "i686-linux"))
    #~(a b c d))

I feel like it’s better this way, though it could be confusing.

Thoughts?

Besides, ‘with-parameters’ is the dual of what was discussed at
<https://issues.guix.gnu.org/issue/29296>.

Thanks,
Ludo’.

Ludovic Courtès (1):
  gexp: Add 'with-parameters'.

 .dir-locals.el |  1 +
 doc/guix.texi  | 19 ++++++++++++++++
 guix/gexp.scm  | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/gexp.scm | 28 ++++++++++++++++++++++++
 4 files changed, 107 insertions(+)

-- 
2.25.1

             reply	other threads:[~2020-03-06 10:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-06 10:41 Ludovic Courtès [this message]
2020-03-06 10:53 ` [bug#39945] [PATCH 1/1] gexp: Add 'with-parameters' Ludovic Courtès
2020-03-06 11:06 ` [bug#39945] [PATCH 0/1] Introducing 'with-parameters' for gexp dynamic binding Mathieu Othacehe
2020-03-12 17:34   ` bug#39945: " 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=20200306104108.19503-1-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=39945@debbugs.gnu.org \
    /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.