unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: zimoun <zimon.toutoune@gmail.com>
Cc: 51307-done@debbugs.gnu.org
Subject: [bug#51307] [PATCH v2 3/3] scripts: hash: Add git serializer.
Date: Tue, 21 Dec 2021 10:09:01 +0100	[thread overview]
Message-ID: <87bl1ab9zm.fsf@gnu.org> (raw)
In-Reply-To: <CAJ3okZ00+BSw=nuhGP8NTwU8ZmitzrfFzTw0WecsOB9rZ+hG_g@mail.gmail.com> (zimoun's message of "Mon, 20 Dec 2021 15:21:18 +0100")

Hi,

zimoun <zimon.toutoune@gmail.com> skribis:

> On Mon, 20 Dec 2021 at 14:40, Ludovic Courtès <ludo@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’.




  parent reply	other threads:[~2021-12-21  9:10 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20 16:50 [bug#51307] [PATCH 0/2] guix hash: eases conversion zimoun
2021-10-20 16:54 ` [bug#51307] [PATCH 1/2] scripts: hash: Improve error handling zimoun
2021-10-20 16:54   ` [bug#51307] [PATCH 2/2] scripts: hash: Support file or package zimoun
2021-10-30 14:48     ` [bug#51307] [PATCH 0/2] guix hash: eases conversion Ludovic Courtès
2021-10-30 15:34       ` zimoun
2021-10-30 14:46   ` Ludovic Courtès
2021-10-30 15:40     ` zimoun
2021-10-31 13:43       ` Ludovic Courtès
2021-10-30 14:53 ` Ludovic Courtès
2021-10-30 15:19   ` zimoun
2021-10-30 15:24     ` zimoun
2021-10-31 14:03     ` Ludovic Courtès
2021-11-09  9:18       ` zimoun
2021-10-31 14:48     ` [bug#51307] Content hashes and file tree serialization methods Ludovic Courtès
2021-11-18  0:29       ` zimoun
2021-11-18  0:20 ` [bug#51307] [PATCH v2 0/3] scripts: hash: Several files and serializer zimoun
2021-11-18  0:20   ` [bug#51307] [PATCH v2 1/3] scripts: hash: Support several files zimoun
2021-12-17 16:17     ` Ludovic Courtès
2021-11-18  0:20   ` [bug#51307] [PATCH v2 2/3] scripts: hash: Add 'serializer' option zimoun
2021-12-17 16:17     ` Ludovic Courtès
2021-11-18  0:20   ` [bug#51307] [PATCH v2 3/3] scripts: hash: Add git serializer zimoun
     [not found]     ` <87bl1bjsxf.fsf@gnu.org>
     [not found]       ` <CAJ3okZ00+BSw=nuhGP8NTwU8ZmitzrfFzTw0WecsOB9rZ+hG_g@mail.gmail.com>
2021-12-21  9:09         ` Ludovic Courtès [this message]
2021-12-15  8:06   ` [bug#51307] [PATCH v2 0/3] scripts: hash: Several files and serializer zimoun
2021-12-15 10:05     ` 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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bl1ab9zm.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=51307-done@debbugs.gnu.org \
    --cc=zimon.toutoune@gmail.com \
    /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 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).