all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Alex Kost <alezost@gmail.com>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: Merging guix.el
Date: Thu, 28 Aug 2014 22:09:41 +0200	[thread overview]
Message-ID: <87wq9s4bqy.fsf@gnu.org> (raw)
In-Reply-To: <87tx4wlbis.fsf@gmail.com> (Alex Kost's message of "Thu, 28 Aug 2014 22:22:35 +0400")

Alex Kost <alezost@gmail.com> skribis:

> Ludovic Courtès (2014-08-28 16:41 +0400) wrote:
>
>> Alex Kost <alezost@gmail.com> skribis:
>>
>>> Ludovic Courtès (2014-08-23 16:17 +0400) wrote:

[...]

> OK, I think it would be good to make "emacs-ui" branch temporary, so
> that after I'll fix everything that needs to be fixed, it may be
> recreated with a nice and clean commit(s) for merging “guix.el”.  This
> way I could push commits there without a fear that I mess it all up.
> WDYT?

Definitely.  What’s been done before for such work-in-progress branches
is to rewrite them until they’re ready, and then merge them.  So if you
agree to adjust that commit and then delete+push the branch, it’s
perfect.  (By convention, we normally call these branches wip-* so that
people understand that they may be rebased.)

Now, I think we’re almost there anyway, so hopefully you’ll merge real
soon.  :-)

>>> I imagine there may be... for example vi users, who wouldn't want to
>>> install this feature, so I made some changes in "configure.ac" to add
>>> “--disable-emacs-ui” option.
>>
>> It seems that the only things that cannot be done when Emacs is not
>> available is the generation of the autoloads file, right?
>
> Yes.
>
>> Then, what about adding $(AUTOLOADS) to the distribution?  It would just
>> need to be appended to dist_lisp_DATA, and not added to CLEANFILES.
>
> OK, will be done.  And what about "configure.ac"?  I thought a new
> configure option is good.  Should I delete it?

I think so, yes, because it wouldn’t make any difference if the
autoloads are already generated.  Non-Emacs users would end up
installing a few files that they would not use, but that’s not big deal
IMO.

>>> Also I use almost the same code in "guix-helper.scm.in" that is used in
>>> "scripts/guix.in", so I think it will be good to have some little
>>> additional module with ‘config-lookup’ function.  WDYT?
>>
>> It cannot be in a module, because at this point the module location
>> isn’t known yet.  I don’t really know how to factorize it, so I propose
>> to leave it for later, with a FIXME.  Maybe Mark has an idea?
>>
>> +(define %current-manifest)
>> +(define current-manifest-entries-table)
>> +(define packages)
>> +(define packages-table)
>>
>> I didn’t know this was possible, but we shouldn’t rely on it.
>
> Do you mean definitions without initial values?

Yes.

[...]

>> Also, my understanding is that ‘current-manifest-entries-table’ is here
>> to speed up lookups in ‘manifest-entries-by-name+version’, right?
>
> Yes, ‘current-manifest-entries-table’ and ‘packages-table’ are there to
> speed up the process of finding “manifest entries”/“packages” by
> name+version (it is a very general need).  Also
> ‘current-manifest-entries-table’ is used in ‘fold-manifest-entries’.

OK.

>> Then, I think this optimization should go into (guix profiles):
>> <manifest> objects would carry that vhash, and ‘manifest-installed?’
>> etc. would make use of it.  The constructor would be changed along these
>> lines:

[...]

> I think it's a good idea, but if that "name" is just a package name,
> I can't use this optimization: I need to define entries by
> "name+version".

Yes, makes sense.  So that ‘name->entries’ field would map a package
name to a list of entries; in the most common case, there’ll be just one
entry anyway.  How does that sound?

> Also I think it should be ‘name->entries’ as there can be several
> manifest entries with the same name (or name/version).

Yes, sure.

>> Given that ‘set-packages!’ has only on call site, what about removing
>> it, and instead writing directly:
>>
>>   (define %packages
>>     (fold-packages ... vlist-null))
>>
>>   (define %package-count
>>     (length %packages))
>>
>>   (define %package-table
>>     (vlist-fold ...))
>>
>> It’s also best to prefix global variable names with ‘%’.
>
> Yes, it's definitely better, except I don't know how to fill a table
> with ‘vlist-fold’ and I don't see a better variant than this:
>
> (define %package-table
>   (let ((table (make-hash-table %package-count)))
>     (vlist-for-each (lambda (elem)
>                       (let* ((pkg (cdr elem))
>                              (key (name+version->key
>                                    (package-name pkg)
>                                    (package-version pkg)))
>                              (ref (hash-ref table key)))
>                         (hash-set! table key
>                                    (if ref (cons pkg ref) (list pkg)))))
>                     packages)
>     table))

I would make %package-table a vhash instead of a hash table:

  (define %package-table
    (vlist-fold (lambda (elem result)
                  (match elem
                    ((name . package)
                     (vhash-cons (cons (package-name package)
                                       (package-version package))
                                 package
                                 (if (vhash-assq name result)
                                     ...)))))
                vlist-null
                %packages))

> P.S.  OMG!  Thank you very much for reviewing all that crap.  Elisp
> code is much better (I hope :-)).

Np, I trust you on the elisp code.  :-)

Ludo’.

  reply	other threads:[~2014-08-28 20:09 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-23 12:17 Merging guix.el Ludovic Courtès
2014-08-24  6:59 ` Alex Kost
2014-08-25  8:23   ` Ludovic Courtès
2014-08-25 12:31     ` Alex Kost
2014-08-25 22:03       ` Ludovic Courtès
2014-08-26  4:14         ` Alex Kost
2014-08-27 13:11 ` Alex Kost
2014-08-28 12:41   ` Ludovic Courtès
2014-08-28 18:22     ` Alex Kost
2014-08-28 20:09       ` Ludovic Courtès [this message]
2014-08-29 18:24         ` Alex Kost
2014-08-31 14:59           ` Ludovic Courtès
2014-09-01  8:26             ` Alex Kost
2014-09-01 12:10               ` Ludovic Courtès
2014-09-02 20:22                 ` Alex Kost
2014-09-03  7:09                   ` Ludovic Courtès
2014-09-03 20:53                     ` Alex Kost
2014-09-01 22:28               ` Ludovic Courtès
2014-09-02 20:22                 ` Alex Kost
2014-09-02 21:13                   ` Ludovic Courtès
2014-09-02 20:22             ` Alex Kost
2014-09-02 21:09               ` 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=87wq9s4bqy.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=alezost@gmail.com \
    --cc=guix-devel@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.