guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Merging guix.el


From: Ludovic Courtès
Subject: Re: Merging guix.el
Date: Thu, 28 Aug 2014 22:09:41 +0200
User-agent: Gnus/5.130011 (Ma Gnus v0.11) Emacs/24.3 (gnu/linux)

Alex Kost <address@hidden> skribis:

> Ludovic Courtès (2014-08-28 16:41 +0400) wrote:
>
>> Alex Kost <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]