unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* gexps and ‘with-imported-modules’
@ 2016-07-03 22:20 Ludovic Courtès
  2016-07-04  7:45 ` Alex Kost
  2016-07-12 20:58 ` Ludovic Courtès
  0 siblings, 2 replies; 4+ messages in thread
From: Ludovic Courtès @ 2016-07-03 22:20 UTC (permalink / raw)
  To: guix-devel

Hello!

The ‘wip-gexp-imported-modules’ branch changes gexps so that each gexp
embeds information about which modules need to be imported into its
execution environment.

Before you would do:

  (gexp->derivation "foo"
                    #~(begin
                        (use-modules (guix build utils))
                        …)
                    #:modules '((guix build utils)))

to specify that (guix build utils) must be imported in the build
environment of “foo”.  After, it becomes:

  (gexp->derivation "foo"
                    (with-imported-modules '((guix build utils))
                      #~(begin
                          (use-modules (guix build utils))
                          …)))

The gain (not visible here) is that when you nest gexps, the outermost
gexp now contains all the info about modules that need to be imported.
That way, no side channel is needed to carry the imported module info
(by “side channel”, I mean things like the ‘imported-modules’ field
currently found in <shepherd-service> and several other places.)  Thus,
it should be easier to compose gexps.

I plan to merge it within a day or two.

Comments welcome!

Ludo’.

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

* Re: gexps and ‘with-imported-modules’
  2016-07-03 22:20 gexps and ‘with-imported-modules’ Ludovic Courtès
@ 2016-07-04  7:45 ` Alex Kost
  2016-07-04 13:39   ` Ludovic Courtès
  2016-07-12 20:58 ` Ludovic Courtès
  1 sibling, 1 reply; 4+ messages in thread
From: Alex Kost @ 2016-07-04  7:45 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2016-07-04 01:20 +0300) wrote:

> Hello!
>
> The ‘wip-gexp-imported-modules’ branch changes gexps so that each gexp
> embeds information about which modules need to be imported into its
> execution environment.
>
> Before you would do:
>
>   (gexp->derivation "foo"
>                     #~(begin
>                         (use-modules (guix build utils))
>                         …)
>                     #:modules '((guix build utils)))
>
> to specify that (guix build utils) must be imported in the build
> environment of “foo”.  After, it becomes:
>
>   (gexp->derivation "foo"
>                     (with-imported-modules '((guix build utils))
>                       #~(begin
>                           (use-modules (guix build utils))
>                           …)))
>
> The gain (not visible here) is that when you nest gexps, the outermost
> gexp now contains all the info about modules that need to be imported.
> That way, no side channel is needed to carry the imported module info
> (by “side channel”, I mean things like the ‘imported-modules’ field
> currently found in <shepherd-service> and several other places.)  Thus,
> it should be easier to compose gexps.

Great!  I like 'with-...' things.  And wow, you did a huge work again!

> I plan to merge it within a day or two.
>
> Comments welcome!

I see you added the indentation rule for 'with-imported-modules' in
"emacs/guix-devel.el".  I think it would also be good to add it to
'guix-devel-keywords' (as you did in commit cd6f6c22fb) to make it
highlighted as the other keywords.

-- 
Alex

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

* Re: gexps and ‘with-imported-modules’
  2016-07-04  7:45 ` Alex Kost
@ 2016-07-04 13:39   ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2016-07-04 13:39 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> Ludovic Courtès (2016-07-04 01:20 +0300) wrote:
>
>> Hello!
>>
>> The ‘wip-gexp-imported-modules’ branch changes gexps so that each gexp
>> embeds information about which modules need to be imported into its
>> execution environment.
>>
>> Before you would do:
>>
>>   (gexp->derivation "foo"
>>                     #~(begin
>>                         (use-modules (guix build utils))
>>                         …)
>>                     #:modules '((guix build utils)))
>>
>> to specify that (guix build utils) must be imported in the build
>> environment of “foo”.  After, it becomes:
>>
>>   (gexp->derivation "foo"
>>                     (with-imported-modules '((guix build utils))
>>                       #~(begin
>>                           (use-modules (guix build utils))
>>                           …)))
>>
>> The gain (not visible here) is that when you nest gexps, the outermost
>> gexp now contains all the info about modules that need to be imported.
>> That way, no side channel is needed to carry the imported module info
>> (by “side channel”, I mean things like the ‘imported-modules’ field
>> currently found in <shepherd-service> and several other places.)  Thus,
>> it should be easier to compose gexps.
>
> Great!  I like 'with-...' things.  And wow, you did a huge work again!

Thank you.  I think it’ll be beneficial.  It makes more sense to provide
imported-module info at the gexp creation site rather than at the use
site.

>> I plan to merge it within a day or two.
>>
>> Comments welcome!
>
> I see you added the indentation rule for 'with-imported-modules' in
> "emacs/guix-devel.el".  I think it would also be good to add it to
> 'guix-devel-keywords' (as you did in commit cd6f6c22fb) to make it
> highlighted as the other keywords.

Will do!

Ludo’.

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

* Re: gexps and ‘with-imported-modules’
  2016-07-03 22:20 gexps and ‘with-imported-modules’ Ludovic Courtès
  2016-07-04  7:45 ` Alex Kost
@ 2016-07-12 20:58 ` Ludovic Courtès
  1 sibling, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2016-07-12 20:58 UTC (permalink / raw)
  To: guix-devel

Hi!

ludo@gnu.org (Ludovic Courtès) skribis:

> The ‘wip-gexp-imported-modules’ branch changes gexps so that each gexp
> embeds information about which modules need to be imported into its
> execution environment.

Merged!

This changes the ABI of (guix gexp) and (guix packages) so you need to:

  make clean-go && make

Please report any test suite failure or bug.

The change is mostly neutral in terms of lines of code:

--8<---------------cut here---------------start------------->8---
$ git diff affd7761f3b38f7d5670a4e91fefef72174621cc..1929fdba80ab2432d0a9c27633c94a79fb3bb170 |diffstat
 .dir-locals.el                 |    1 
 doc/guix.texi                  |   74 ++++--
 emacs/guix-devel.el            |    2 
 gnu/packages/engineering.scm   |    4 
 gnu/packages/wm.scm            |    1 
 gnu/services.scm               |  100 +++-----
 gnu/services/base.scm          |  151 ++++++-------
 gnu/services/dbus.scm          |   37 +--
 gnu/services/desktop.scm       |   65 ++---
 gnu/services/networking.scm    |   50 ++--
 gnu/services/shepherd.scm      |   41 +--
 gnu/services/xorg.scm          |   38 +--
 gnu/system.scm                 |    3 
 gnu/system/install.scm         |  105 ++++-----
 gnu/system/linux-container.scm |   49 ++--
 gnu/system/linux-initrd.scm    |  170 +++++++-------
 gnu/system/locale.scm          |    8 
 gnu/system/mapped-devices.scm  |   30 +-
 gnu/system/shadow.scm          |   64 ++---
 gnu/system/vm.scm              |  152 ++++++-------
 gnu/tests.scm                  |  112 ++++-----
 gnu/tests/base.scm             |  468 ++++++++++++++++++++---------------------
 gnu/tests/install.scm          |   68 ++---
 guix/cvs-download.scm          |   20 -
 guix/download.scm              |   57 ++--
 guix/gexp.scm                  |  133 +++++++----
 guix/git-download.scm          |   36 +--
 guix/hg-download.scm           |   22 -
 guix/packages.scm              |  185 +++++++---------
 guix/profiles.scm              |  378 ++++++++++++++++-----------------
 guix/scripts/system.scm        |    2 
 guix/svn-download.scm          |   22 -
 tests/gexp.scm                 |  100 ++++++--
 tests/grafts.scm               |   16 -
 tests/packages.scm             |    1 
 35 files changed, 1424 insertions(+), 1341 deletions(-)
--8<---------------cut here---------------end--------------->8---

I was expecting a slight SLOC decrease, but I’m happy nonetheless.  ;-)

Ludo’.

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

end of thread, other threads:[~2016-07-12 20:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-03 22:20 gexps and ‘with-imported-modules’ Ludovic Courtès
2016-07-04  7:45 ` Alex Kost
2016-07-04 13:39   ` Ludovic Courtès
2016-07-12 20:58 ` Ludovic Courtès

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