From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tomas Volf <~@wolfsden.cz> Newsgroups: gmane.lisp.guile.user Subject: How to have an optional dependency? Date: Mon, 24 Jun 2024 20:54:34 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="31GN937gZXzS0qPI" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29249"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon Jun 24 20:55:24 2024 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sLoqa-0007MT-EB for guile-user@m.gmane-mx.org; Mon, 24 Jun 2024 20:55:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sLopy-0004if-SR; Mon, 24 Jun 2024 14:54:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <~@wolfsden.cz>) id 1sLopv-0004iQ-Dv for guile-user@gnu.org; Mon, 24 Jun 2024 14:54:43 -0400 Original-Received: from wolfsden.cz ([37.205.8.62]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <~@wolfsden.cz>) id 1sLopt-0005xM-6f for guile-user@gnu.org; Mon, 24 Jun 2024 14:54:43 -0400 Original-Received: by wolfsden.cz (Postfix, from userid 104) id 8B5892A17EC; Mon, 24 Jun 2024 18:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1719255276; bh=6Rj30Bu6wlW1Z9FXVBNVc80mrsaQVcfwoOt4gBZiEGc=; h=Date:From:To:Subject; b=fm+gplTuwDrooFuy3/zjkmIWL61ScgrmEAy2MEIc65xHeKcMkWQAXpuPDP0mmEY0J 6jWy3888g8rvJTwN6/SMKaf7DVUq0IIAR04nDk1vopiuIkgn1ilM0Z+YPpvd1WOoBx 5IYCUWvjitpMOngO1KY0lVeXqpUPNhkpZB1M16t4s/KEwwMSihHVvKKrNIgwibD20j TD+3Yw1vwQ/6caWKS0OFWuc783JEJIesLfysDNmLwDgvFXnv43fDGc1aSr9dIo1pSE LhK2NFOwYUVasj1TkzNC2R/Y6KuaRuSN5QRV9l1cMWlpkm9PWX7y9IOr5VDF8iy67x rgKcvjsuYekKmlUJfWfLDo/nDb0uFvQE2GvhdOxuPJlR7vKyv2ZqIQe8xpXO8TZ6TW kpuBlXbp64hlAF5lF8LxU5ika/k2y2+vvaluLHzXynPCzDmTjmMvKaXDTJChWBQ+2P kOh1WSDiwrDgyn0qTANO9gq52Bu2hC3UrAODS9qnvq26+507vVH7myiwGVFutNLNKJ x+lNipiOb9sWcfraLe5ftSAdxo9P8U8UCssd19k6N+znQxC8w39f7IOOOgO2ktg439 +XPY/0Zm/gjUUVHZS3I6LcsD5pATjIRcdsIchFvGdcwh3faj4UtgYQ5m5J2hEMZFc7 NxGNINXYa7o9vgBaxHpTe26U= Original-Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id BEC0A29FFFF for ; Mon, 24 Jun 2024 18:54:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1719255275; bh=6Rj30Bu6wlW1Z9FXVBNVc80mrsaQVcfwoOt4gBZiEGc=; h=Date:From:To:Subject; b=SV/83jkxxMxZ8PjxOnAzb5Mz9rFGZRz63ZaNTxymLacdzcpBMObzoiWCd7CBkmf/D IGgFZLX+bdj0RXnyYKaEiGzkVGV9JD7YsZ8YxOYAN9SbE9amteprrO7s1AiN9SvYdt ss+tFfUUUsxVLYPqXQcE9KBqTFRUrvmRYnoCGEJGas5Y7iJxLp7aQgfhlH0nM0IEym 7pefyo0hgs0IPlAmY9MkLQnWKBnamizO6BsgQPXR/2INZ8E+fF2TTl3HShM7iN7q9Y ohZHqFSZi2VCiMtSLE6iw+7tZflzFbw3L5zgPX/jOWrwTSHz/iodhiP2WqF2w60QdP I5MYzqhu3ikg4h2OXH5u/vUxqTstBm+2b5OhWcuIHNAOpPom7YFHFr/xl02ktJBb6w 3talB17oJ7Zn2rEnxL2puHYq1n79FqKeNwpnzjuaGz5XtiFbYTkjBo2Yi77AD8+uCP nCUt124JtcwSa2TnGcrE2tBv07TrCR6A71wQ00rpjJrq5zHSu4NpVrLgUzHgUNzw1v 9syjd6Wha/YUxi3UinycazgKQBEGkehsaCf2BjtYP4aaZsYWUn25mlgGn1SVXV5IJ6 meWQDIp2EBtaOEWDVN01ZGYYUxWa4RKzqkSc0/YdDCcOtvdQZYVwLFsZ+ZbPJlCkjC 4ZhJKsRtBmILkTZt+cAME98c= Mail-Followup-To: guile-user@gnu.org Content-Disposition: inline Received-SPF: pass client-ip=37.205.8.62; envelope-from=~@wolfsden.cz; helo=wolfsden.cz X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19726 Archived-At: --31GN937gZXzS0qPI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi! I am writing a module in Guile, and I would like to have an optional dependency on another library. And I am not sure how to express it. So far I found that #:autoload can be used for it. I have tried two approaches: #:autoload (guix derivations) (build-derivations derivation? derivation->output-path) #:autoload (guix gexp) (lower-object) #:autoload (guix store) (run-with-store store-protocol-error? with-store) This works, but when I try to compile my library in environment without Guix, I get a lot of warnings in the build log: ;;; Failed to autoload with-store in (guix store): ;;; no code for module (guix store) ;;; Failed to autoload run-with-store in (guix store): ;;; no code for module (guix store) ... The build does succeed, but the spam in the logs is annoying. The other approach I discovered is using module-autoload!: (module-autoload! (current-module) '(guix derivations) '(build-derivations derivation? derivation->output-path) '(guix gexp) '(lower-object) '(guix store) '(run-with-store store-protocol-error? with-store)) This *also* works, but *also* leads to (different) warnings: wolfsden/guix/utils.scm:62:14: warning: possibly unbound variable `with-store' wolfsden/guix/utils.scm:62:25: warning: possibly unbound variable `%store' wolfsden/guix/utils.scm:63:16: warning: possibly unbound variable `run-with-store' wolfsden/guix/utils.scm:64:18: warning: possibly unbound variable `lower-object' wolfsden/guix/utils.scm:66:14: warning: possibly unbound variable `store-protocol-error?' wolfsden/guix/utils.scm:70:9: warning: possibly unbound variable `build-derivations' wolfsden/guix/utils.scm:71:20: warning: possibly unbound variable `derivation?' wolfsden/guix/utils.scm:72:20: warning: possibly unbound variable `derivation->output-path' Is there a way to have a module as an optional dependency without any warnings? For example, is there a way to convince the Guile that those specific variables will be bound? How do people commonly approach this? Thanks, Tomas Volf -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. --31GN937gZXzS0qPI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmZ5wOoACgkQL7/ufbZ/ wamySQ//dUwcttw00HOYWiCN3q5ToI0P6JHdoDW5DgZLWeyAXVE4f+OHHeATZ8XU FzfQ75S4BEL79lQ3/XYZ8W4dv8penqar7v6LBw97sDE9iRivd3JIRkE3NbNL/I7Q vzoaCO26UuhhkZ+LHAD63FcPp3j/a9Ti/Il5Jap0RNVE3ADETw/9fYYNt+UPElot GTe52dNz4ubf3xw314JLDRpKdoVbTSM2puYCglE0AxqvqxgEEiGLUnP+1tqDLt0b oKQagUs+slkd/sKkfU+hPm/H4j1pQw7dJHI/VqYMzK3lB0hHgryj/344XgQTb7rM txARGnKU1eVApN9Nyv9nPzAk7p5makjRSrm/PBYPFlgcRL1IpcojEgF67Su/WzoY 8cxqQT5MjTPv2ThCysm3O4EzGsV5DTVBGtkCjgFZosj8arR4/9cU8NRRhG9pP6Re H8pGSi2TE3O3q0+co/8Vh1X+gxme8IicOz6wraozH6Wp/7BTBxkfA2A48fE+D1a4 Y3RFZIDYJrWhjcbXTI6JJ2awaFWJJHOKRyhq2iwSIDcVrjgXqdKY9/0NsgeC8Kmx gXe0EmltzWEC76YTXgf62NMKMzAILSlF5dYfAti6mNyhK/XL+ZaLBiGHMoG8pQ1f 1Wj8QjnqO+jSvEzH7XcpXysFAyXvxLbi2Wd5ju76MNd6KOQnopc= =4hmx -----END PGP SIGNATURE----- --31GN937gZXzS0qPI--