all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nicolas Graves via Bug reports for GNU Guix <bug-guix@gnu.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: Josselin Poiret <dev@jpoiret.xyz>, 62589@debbugs.gnu.org
Subject: bug#62589: Help with patch with delayed evaluation
Date: Sat, 01 Apr 2023 17:27:38 +0200	[thread overview]
Message-ID: <87cz4nfwr9.fsf@ngraves.fr> (raw)
In-Reply-To: <87fs9jg974.fsf@ngraves.fr>

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	other threads:[~2023-04-01 15:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-01  9:58 bug#62589: Help with patch with delayed evaluation Nicolas Graves via Bug reports for GNU Guix
2023-04-01 10:05 ` bug#62589: [PATCH] gnu: nerd-dictation: Factor out wrapper. Add package variants Nicolas Graves via Bug reports for GNU Guix
2023-04-01 10:28   ` bug#62589: Help with patch with delayed evaluation Ludovic Courtès
2023-04-01 10:58     ` Nicolas Graves via Bug reports for GNU Guix
2023-04-01 15:27       ` Nicolas Graves via Bug reports for GNU Guix [this message]
2023-04-17 15:41     ` Nicolas Graves via Bug reports for GNU Guix
2023-04-01 17:32 ` bug#62589: [PATCH] gnu: nerd-dictation: Factor out wrapper. Add package variants Nicolas Graves via Bug reports for GNU Guix
2023-04-24 20:53   ` bug#62589: Help with patch with delayed evaluation Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cz4nfwr9.fsf@ngraves.fr \
    --to=bug-guix@gnu.org \
    --cc=62589@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=ludo@gnu.org \
    --cc=ngraves@ngraves.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.