[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using package-for-guile2.0 outside of guile.scm
From: |
Ludovic Courtès |
Subject: |
Re: using package-for-guile2.0 outside of guile.scm |
Date: |
Tue, 29 Jan 2019 23:15:26 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Hi!
Ludovic Courtès <address@hidden> skribis:
> Ricardo Wurmus <address@hidden> 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’s a reference
>> 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 ‘package-with-guile-2.0’ needs to resolve
> ‘guile-2.0’. So if you use it at the top-level, then (gnu packages
> guile) has to be fully loaded, or you have to be in (gnu packages guile)
> itself and ‘guile-2.0’ has been defined above.
>
> I think we can get around it using this cute hack. I’ll commit it if
> that’s fine with you.
As you found out, that’s not enough. The reason is that
‘package-input-rewriting’ is inherently greedy, not lazy. For example:
(let ((rewrite (package-input-rewriting `((,p . ,q)))))
(eq? q (rewrite p)))
=> #t
This works only because the replacement alist is traversed as soon as
‘rewrite’ is called.
Needs more thought…
Ludo’.