bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62589: Help with patch with delayed evaluation


From: Nicolas Graves
Subject: bug#62589: Help with patch with delayed evaluation
Date: Sat, 01 Apr 2023 17:27:38 +0200

On 2023-04-01 12:58, Nicolas Graves wrote:

> On 2023-04-01 12:28, Ludovic Courtès wrote:
>
>> Hi,
>>
>> Nicolas Graves <ngraves@ngraves.fr> skribis:
>>
>>> +(define* (make-nerd-dictation-package
>>> +          input-tool output-tool
>>> +          #:key (nerd-dictation-package nerd-dictation))
>>> +  "Construct a nerd-dictation package for OUTPUT-TOOL."
>>> +  (match-let* (((input-name output-name)
>>> +                (map (lambda (tool)
>>> +                       (lazy
>>> +                        (delay (package-name (force tool)))))
>>> +                     (list input-tool output-tool))))
>>> +    (package
>>> +      (inherit nerd-dictation-package)
>>> +      (name (string-append "nerd-dictation-"
>>> +                           (if (equal? (force input-name) "sox")
>>> +                               "sox-"
>>> +                              "")
>>> +                           (force output-name)))
>>
>> I don’t understand the details of what the patch does, but as a rule of
>> thumb, make sure you only ever inherit from packages defined in the same
>> module.
>
> The patch defines a helper for defining variants of nerd-dictation. It
> now supports wtype and I wasn't totally satisfied by international
> support for ydotool, so I wanted to switch, but copying it make a lot of
> repeated code.
>
> I already defined such a helper with Liliana Marie Prinkler with
> make-emacs-eval-in-repl, but this time I don't understand this error.
>
> Josselin was suggesting a module import cycle, (gnu packages
> machine-learning) is imported in (gnu packages audio), the error might
> come from there. 
>
>>
>> Perhaps that’s what was going wrong?
>
> I've tried inheriting from the above package direclty, doesn't seem to
> be that.
>
>>
>> HTH,
>> Ludo’.

After thinking and experimenting, I think what I'm trying to do is not
possible in this file. This is for a record if someone has the same kind
of issue in the future. 

When I include sox or wtype as a regular input, it works fine. But it
doesn't work when called from another function, I think the issue is
indeed the same as when inheriting from a package.

Now, there is the counterexample of the make-emacs-eval-in-repl
function. IIUC, this example works with delayed evaluation because all
the packages it calls are defined *in the same file*. To test this, on
way could be to test inheritance on a package defined in the same file
but after the inheriting package definition. IIRC, it doesn't work, but
might when using delayed evaluation.

This aside, the packages I'm trying to load are outside the file, and
this is probably the reason why it works for make-emacs-eval-in-repl and
not this function.

I will try to circumvent the issue by factorising less, maybe just the
gexp, but not propagated-inputs. 

-- 
Best regards,
Nicolas Graves





reply via email to

[Prev in Thread] Current Thread [Next in Thread]