GNU bug report logs -
#50286
[RFC PATCH] Let 'package-location' returns location of surrounding 'let'.
Previous Next
Reported by: Maxime Devos <maximedevos <at> telenet.be>
Date: Mon, 30 Aug 2021 21:28:01 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #20 received at 50286 <at> debbugs.gnu.org (full text, mbox):
Hello,
Maxime Devos <maximedevos <at> telenet.be> skribis:
> 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?
A package always has a ‘location’, but it may lack a definition
location, for instance if it’s produced by a procedure, or if it’s not
bound to a top-level variable.
Things like ‘package-field-location’ are likely more accurate if they
start searching from the beginning of the (package …) sexp.
These patches leave the UIs unchanged (‘guix show’, ‘guix edit’, etc.)
because I think ‘location’ is good for these.
> 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'?
‘define-public*’ is exported as ‘define-public’, so package definitions
do not need to be changed:
#:replace ((define-public* . 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.
Yeah, I see what you mean. The work ‘guix refresh -u’ and ‘guix style’
do is essentially correlating live objects (package records) to their
source code. This is necessarily an approximation; it’s similar to
version strings constructed with ‘string-append’: that’s something that
inspection of the live object cannot reveal, so we use heuristic to
match common conventions.
Thoughts?
Thanks,
Ludo’.
This bug report was last modified 3 years and 336 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.