RE: How to have an optional dependency?

Maxime Devos via General Guile related discussions <[email protected]>
Newsgroups gmane.lisp.guile.user
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.