GNU bug report logs -
#51307
[PATCH 0/2] guix hash: eases conversion
Previous Next
Reported by: zimoun <zimon.toutoune <at> gmail.com>
Date: Wed, 20 Oct 2021 16:51:01 UTC
Severity: normal
Tags: patch
Done: zimoun <zimon.toutoune <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Hi,
zimoun <zimon.toutoune <at> gmail.com> skribis:
> On Mon, 20 Dec 2021 at 14:40, Ludovic Courtès <ludo <at> gnu.org> wrote:
>
>> > + #:use-module ((disarchive git-hash) #:select (git-hash-file
>> > + git-hash-directory))
>>
>> Use #:autoload (that makes Disarchive a soft dependency and also reduces
>> start-up time.)
>
> Thanks. As I asked in the cover-letter, these are confusing for me.
> For instance, why not autoloading all the used modules? And is it
> better to lazily load with something like:
>
> (match (and=> (resolve-module '(disarchive) #:ensure #f)
> (lambda (disarchive)
> (cons (module-ref disarchive '%disarchive-log-port)
> (module-ref disarchive 'disarchive-assemble))))
> (#f (format #t "could not load Disarchive~%")
> #f)
> ((%disarchive-log-port . disarchive-assemble)
>
> ? From guix/build/download.scm, or any other "lazy reference" in the code code.
>
> What are the differences? I have read the documentation but it is not
> clear for me the difference between '#:autoload' and 'module-ref'.
There are several reasons for autoloading: one is startup time/memory
footprint, and another one is having “soft dependencies” (you can still
build and use the thing when the dependency is missing; only that
specific feature is unavailable.)
Usually we’d use #:autoload, but in cases where we want full control
over the process, as in the Disarchive snippet you show above, we’d use
the programmatic interface.
There are also cases of “lazy references” where we use the programmatic
interface to load things at run time. This is used for instance to keep
(guix …) modules independent of (gnu …) modules.
I hope this sheds some light!
>> I was wondering whether we should keep the deprecation warning for ‘-r’;
>> we might consider it a handy shorthand for ‘-S nar’?
>
> Ah, yes. Deprecate '--recursive' but keep '-r' as shorthand for '-S
> nar'. LGTM.
I’d treat ‘-r’ and ‘--recursive’ in the same way, no? That is, keep
them both without a deprecation warning, but document them as aliases
for ‘-S nar’. WDYT?
Thanks,
Ludo’.
This bug report was last modified 3 years and 155 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.