From mboxrd@z Thu Jan 1 00:00:00 1970 From: "pelzflorian (Florian Pelz)" Subject: bug#37586: Import cycles in unrelated packages should not be an error Date: Sun, 6 Oct 2019 12:40:14 +0200 Message-ID: <20191006104014.oumwicescs7w3fe7@pelzflorian.localdomain> References: <20191002171547.ncb2hmujdwoxtquy@pelzflorian.localdomain> <877e5ifb2c.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:49203) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iH3yL-0001Ki-9N for bug-guix@gnu.org; Sun, 06 Oct 2019 06:41:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iH3yI-0007Zu-7j for bug-guix@gnu.org; Sun, 06 Oct 2019 06:41:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36821) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iH3yI-0007Zo-3x for bug-guix@gnu.org; Sun, 06 Oct 2019 06:41:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iH3yI-0008ER-0d for bug-guix@gnu.org; Sun, 06 Oct 2019 06:41:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: Content-Disposition: inline In-Reply-To: <877e5ifb2c.fsf@gnu.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 37586@debbugs.gnu.org On Sun, Oct 06, 2019 at 12:00:27PM +0200, Ludovic Courtès wrote: > "pelzflorian (Florian Pelz)" 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