* bug#37586: Import cycles in unrelated packages should not be an error
@ 2019-10-02 17:15 pelzflorian (Florian Pelz)
2019-10-06 10:00 ` Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: pelzflorian (Florian Pelz) @ 2019-10-02 17:15 UTC (permalink / raw)
To: 37586
I am annoyed by another import cycle similar to
<https://issues.guix.info/issue/37346> in an unfinished package I’m
writing. They needlessly complicate packaging and make packagers
split modules that logically should not be split.
Is it possible to make import cycles not an error in Guix packages?
These errors do not surface during module compilation but only when
running guix show or guix build or similar. I suppose that means
changing the way they are evaluated could make packages not care about
dependencies in unrelated packages that just happen to be in the same
module, could it?
Regards,
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#37586: Import cycles in unrelated packages should not be an error
2019-10-02 17:15 bug#37586: Import cycles in unrelated packages should not be an error pelzflorian (Florian Pelz)
@ 2019-10-06 10:00 ` Ludovic Courtès
2019-10-06 10:40 ` pelzflorian (Florian Pelz)
0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2019-10-06 10:00 UTC (permalink / raw)
To: pelzflorian (Florian Pelz); +Cc: 37586
Hi Florian,
"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:
> I am annoyed by another import cycle similar to
> <https://issues.guix.info/issue/37346> in an unfinished package I’m
> writing. They needlessly complicate packaging and make packagers
> split modules that logically should not be split.
I agree that this is annoying.
> Is it possible to make import cycles not an error in Guix packages?
Unfortunately no, it’s fundamentally impossible. When you have:
(define-module (a) #:use-module (b))
(define-public var-a 42)
and:
(define-module (b) #:use-module (a))
(define-public var-b (+ var-a 1))
you can understand that it will or will not work depending on whether
(b) or (a) is loaded first. This is what’s happening here.
> These errors do not surface during module compilation but only when
> running guix show or guix build or similar. I suppose that means
> changing the way they are evaluated could make packages not care about
> dependencies in unrelated packages that just happen to be in the same
> module, could it?
When you use ‘guix show’ or similar, that goes through the package cache
created during ‘guix pull’, which allows Guix to load directly the
module that contains the package. That order could be different from
the one you have in your checkout.
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#37586: Import cycles in unrelated packages should not be an error
2019-10-06 10:00 ` Ludovic Courtès
@ 2019-10-06 10:40 ` pelzflorian (Florian Pelz)
0 siblings, 0 replies; 3+ messages in thread
From: pelzflorian (Florian Pelz) @ 2019-10-06 10:40 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 37586
On Sun, Oct 06, 2019 at 12:00:27PM +0200, Ludovic Courtès wrote:
> "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:
> > Is it possible to make import cycles not an error in Guix packages?
>
> Unfortunately no, it’s fundamentally impossible. When you have:
>
> (define-module (a) #:use-module (b))
> (define-public var-a 42)
>
> and:
>
> (define-module (b) #:use-module (a))
> (define-public var-b (+ var-a 1))
>
> you can understand that it will or will not work depending on whether
> (b) or (a) is loaded first. This is what’s happening here.
> […]
> When you use ‘guix show’ or similar, that goes through the package cache
> created during ‘guix pull’, which allows Guix to load directly the
> module that contains the package. That order could be different from
> the one you have in your checkout.
>
Thank you for the explanation. I now understand that eliminating the
error is not possible within define-module. Currently, all packages
rely on define-module’s “global” #:use-module form. How about adding
an alternative per-package, “local” use-module, to load and unload the
dependent module just for this one package? It appears to be
preferrable to splitting modules. Is it worth it?
Regards,
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-06 10:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-02 17:15 bug#37586: Import cycles in unrelated packages should not be an error pelzflorian (Florian Pelz)
2019-10-06 10:00 ` Ludovic Courtès
2019-10-06 10:40 ` pelzflorian (Florian Pelz)
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.