From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: Re: using package-for-guile2.0 outside of guile.scm Date: Tue, 29 Jan 2019 23:15:26 +0100 Message-ID: <87k1inm7pd.fsf@gnu.org> References: <877eepssan.fsf@elephly.net> <87va29rlr5.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([209.51.188.92]:35075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gobfV-0007tE-0n for guix-devel@gnu.org; Tue, 29 Jan 2019 17:15:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gobfU-0000ne-9L for guix-devel@gnu.org; Tue, 29 Jan 2019 17:15:45 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:45410) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gobfT-0000fl-Og for guix-devel@gnu.org; Tue, 29 Jan 2019 17:15:44 -0500 In-Reply-To: <87va29rlr5.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 28 Jan 2019 13:48:30 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ricardo Wurmus Cc: guix-devel@gnu.org Hi! Ludovic Court=C3=A8s skribis: > Ricardo Wurmus skribis: > >> I tried to move most of the packages in gnu/packages/guile.scm to a new >> module gnu/packages/guile-xyz.scm. >> >> The only problem with this is that package-for-guile2.0 cannot be used >> in guile-xyz.scm. I cannot compile the module when there=E2=80=99s a re= ference >> to package-for-guile2.0, even when the definition is in guile-xyz.scm. >> The definition of package-for-guile2.0 refers to guile-2.2, which is >> located in guile.scm. >> >> What to do? > > The problem is that =E2=80=98package-with-guile-2.0=E2=80=99 needs to res= olve > =E2=80=98guile-2.0=E2=80=99. So if you use it at the top-level, then (gn= u packages > guile) has to be fully loaded, or you have to be in (gnu packages guile) > itself and =E2=80=98guile-2.0=E2=80=99 has been defined above. > > I think we can get around it using this cute hack. I=E2=80=99ll commit i= t if > that=E2=80=99s fine with you. As you found out, that=E2=80=99s not enough. The reason is that =E2=80=98package-input-rewriting=E2=80=99 is inherently greedy, not lazy. = For example: (let ((rewrite (package-input-rewriting `((,p . ,q))))) (eq? q (rewrite p))) =3D> #t This works only because the replacement alist is traversed as soon as =E2=80=98rewrite=E2=80=99 is called. Needs more thought=E2=80=A6 Ludo=E2=80=99.