unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Maxime Devos via General Guile related discussions <guile-user@gnu.org>
To: Tomas Volf <~@wolfsden.cz>, "guile-user@gnu.org" <guile-user@gnu.org>
Subject: RE: How to have an optional dependency?
Date: Mon, 24 Jun 2024 21:21:31 +0200	[thread overview]
Message-ID: <20240624212132.fXMX2C00510dv0x06XMXZx@albert.telenet-ops.be> (raw)
In-Reply-To: <ZnnA6uG_FidZcEAX@ws>

The reason (or at least, a reason) why you are seeing those warnings, is that stuff from autoloaded modules can be macros, so they might be needed during macro expansion (other reason is perhaps for optimization, dunno).

I think the best solution is to modify Guile to do something like adding a #:autoload/no-macro-no-inlining (name to be bikeshed), to be able to tell Guile more explicitly what behaviour is desired. Since #:autoload already exists, it shouldn’t be too difficult, I think. Another option: --assume-autoload-no-macro compilation argument.

>Is there a way to have a module as an optional dependency without any warnings?

I guess you could by adding a directory to your library source code with ‘fake’ (i.e. (define proc-name #false) + #:declarative? #false) Guix modules and add it to GUILE_LOAD_PATH when compiling the module (in Makefile or equivalent).

> For example, is there a way to convince the Guile that those specific variables
will be bound?  How do people commonly approach this?

They don’t (i.e. just deal with the warnings), or do something like ((module-ref (lookup-module '(guix something)) 'proc-name) arguments ...) (that’s not the actual procedure names).

It’s a bit more work up-front, but I recommend doing something like the #:autoload/no-macro-no-inlining thingie instead. Depending on compatibility concerns or lack thereof, you might not be able to _use_ it directly, but eventually Guile X.Y.E isn’t new anymore.

Best regards,
Maxime Devos


      reply	other threads:[~2024-06-24 19:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-24 18:54 How to have an optional dependency? Tomas Volf
2024-06-24 19:21 ` Maxime Devos via General Guile related discussions [this message]

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=20240624212132.fXMX2C00510dv0x06XMXZx@albert.telenet-ops.be \
    --to=guile-user@gnu.org \
    --cc=maximedevos@telenet.be \
    --cc=~@wolfsden.cz \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).