guix-patches
[Top][All Lists]
Advanced

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

[bug#50286] [RFC PATCH] Let 'package-location' returns location of surro


From: Maxime Devos
Subject: [bug#50286] [RFC PATCH] Let 'package-location' returns location of surrounding 'let'.
Date: Tue, 07 Sep 2021 22:30:46 +0200
User-agent: Evolution 3.34.2

Ludovic Courtès schreef op di 07-09-2021 om 21:27 [+0200]:
> Hi Maxime & Sarah,
> 
> Ludovic Courtès <ludo@gnu.org> skribis:
> 
> > Hmm, thinking out loud, what about this: use the same trick as you did,
> > but replace ‘define-public’ instead of ‘let’ & co., so as to be less
> > intrusive.
> > 
> >   (define-syntax-parameter current-definition-location
> >     (identifier-syntax #f))
> > 
> >   (define-syntax define-public*
> >     (syntax-rules ()
> >       ((_ prototype body)
> >        (define-public prototype
> >          (syntax-parameterize ((current-definition-location
> >                                 (identifier-syntax 
> > (current-source-location))))
> >            body)))))
> > 
> > Since there’s code that assumes ‘package-location’ returns the location
> > of the (package …) sexp, we could add a ‘definition-location’ field in
> > <package>, defaulting to ‘current-definition-location’, or tweak
> > ‘location’ to include both.
> 
> Below is an attempt at doing this.  As discussed on IRC, the first patch
> switches the ‘location’ field to a more compact format that may reduce
> load time by a tiny bit, though it’s hard to measure.


> The second patch
> introduces an extra field for the definition location; that means that
> <package> records now occupy an extra word, which is not great, but
> unfortunately OTOH location is slightly smaller.

Why not always let the location of a package be the location of the
surrounding define-public* form, instead of having two separate
locations?  Letting the location of a package be the location of the
define-public* form (or 'let' form) seems more useful to people using
"guix edit minetest-etheral" for example, and the package-field-location
code can easily be adjusted to support 'define-public*' (or let) forms.

If two separate package-definition-location and package-location are
introduced, what should "guix show minetest-ethereal" show?  The location
of the 'package' form, the location of the 'let' form or the location
of the 'define-public' form?

Having two separate define-public* and define-public macros might be a
little confusing.  Would it be possible to let 'define-public*' replace
'define-public'?

I don't really have an opinion on whether package-[field-]location should
return the location of the 'let' form or the location of the 'define-public'
form.  I think 'package-location' should return the location of the 'let'
form (or a surrounding form), because the 'commit' and 'version' variable
from the 'let' form are part of the package -- change them, and you'll
get a different package.

Greetings,
Maxime

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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