From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Linus_Bj=C3=B6rnstam?= Newsgroups: gmane.lisp.guile.user Subject: Re: warning: possibly unused local top-level variable `%foo?-procedure' Date: Fri, 07 Jun 2024 09:26:08 +0200 Message-ID: References: <1674e944-f9c5-415c-ad0d-5c26efac8306@app.fastmail.com> Mime-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28900"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.11.0-alpha0-497-g97f96844c-fm-20240526.001-g97f96844 Cc: guile-user@gnu.org To: "Tomas Volf" <~@wolfsden.cz> Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Jun 07 09:27:22 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 1sFU0O-0007FG-Po for guile-user@m.gmane-mx.org; Fri, 07 Jun 2024 09:27:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFTzq-00031N-76; Fri, 07 Jun 2024 03:26:46 -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 ) id 1sFTzg-0002zO-Gf for guile-user@gnu.org; Fri, 07 Jun 2024 03:26:38 -0400 Original-Received: from wfout6-smtp.messagingengine.com ([64.147.123.149]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFTzc-0002Pz-Fy for guile-user@gnu.org; Fri, 07 Jun 2024 03:26:36 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.west.internal (Postfix) with ESMTP id 5C5E11C0007F; Fri, 7 Jun 2024 03:26:30 -0400 (EDT) Original-Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Fri, 07 Jun 2024 03:26:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.se; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1717745190; x=1717831590; bh=ViIe+yEf5D7hBQJNIld5lP+fK4K9ZusYnb3WuNY9InA=; b= ezg3PuBZVmxhKVHYkYRBBe/7YsE+wxgy2dKU+ETjmcv/1hhE0+K184IS1ljHJB1f bVmV5MRuA0RjkYuezhTWOXWbK6HfPz3l0T5AeVUFwieQGk9hjk867q7QaVDZT6FR ZAimkf6lc5+Qw3J3L+NX2+EVq9JNzXVbGaOJ8jwYYJ3E6d9uHWn/4kg/4OBUWFsM Ys16B5XeT06mTP4oPoc0cYRgzaDZIpqmzvwAqIN/3shoAfb7ncWOOPRg+Zgxfhrm r9HGqWYbcutwyMVn88kxPa2LpvkN5oeB3iIPBWY9RYd2IuUOpux2Kc3tP//iHCum EgbnTxE8KcIlnK3wnPAnug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1717745190; x= 1717831590; bh=ViIe+yEf5D7hBQJNIld5lP+fK4K9ZusYnb3WuNY9InA=; b=E p8Z4Bz067k6VkVAHJV0bbMiGoV0ag7ab0sgxJxddMCayCKD4/TKeiGab5qGgg19E 8O7N7si4aSi8ET9VNRUqDwoca2+sxUZ4cPAjBlZsf8Wl6Yx8OSbleQMtHUFapXEG iU4fFchb4jLazWl76XGwhTNH7vV94Be5HAXbh8G8pVJY/b8nDHBmawTAVnFfdbNM soj8+4fHm9ysEjp0EbFlIIsvs4BzyDYuHQFOXcteq72FFco9/pKcL8qD768uWbbw klB2k771TwN3F7S4hDzJ79NPF71cONj2rcJx6XiSEozKj60LNmrocS47wacSX4PY CU8zVSghBFm29cBlfX7zA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdelledguddukecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvfevufgtgf esthhqredtreerjeenucfhrhhomhepnfhinhhushcuuehjnphrnhhsthgrmhcuoehlihhn uhhsrdhinhhtvghrnhgvthesfhgrshhtmhgrihhlrdhsvgeqnecuggftrfgrthhtvghrnh epleeigeegteeiteeigeevkeejtdduuddtvdelgeegueeiueeuudevffejkeelleeunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhhinhhush drihhnthgvrhhnvghtsehfrghsthhmrghilhdrshgv X-ME-Proxy: Feedback-ID: i57f3436d:Fastmail Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id 78DD5B6008D; Fri, 7 Jun 2024 03:26:29 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: Received-SPF: pass client-ip=64.147.123.149; envelope-from=linus.internet@fastmail.se; helo=wfout6-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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:19708 Archived-At: Thank you for making me realize I use guile-master... I am not really sure what that binding expands into, but it is reasonabl= e to think it has no effect on performance=20 --=20 Linus Bj=C3=B6rnstam On Fri, 7 Jun 2024, at 00:52, Tomas Volf wrote: > On 2024-06-06 22:02:50 +0200, Linus Bj=C3=B6rnstam wrote: >> Which version are you using? All my similar issues with srfi-9 went a= way last year when srfi things were marked maybe-unused. > > I am using the latest 3.0.9. However thanks to your hint about maybe-= unused, I > can see this: > > $ git log v3.0.9.. -- module/srfi/srfi-9.scm > commit 7fef214f6e0df4004020fec530e808c476f2d2bf > Author: Andy Wingo > Date: Sun Mar 17 09:52:49 2024 +0100 > > Remove vestigial code from srfi-9 > > * module/srfi/srfi-9.scm (%define-record-type): No need to def= ine > record-layout. > > commit 19c7969fff223f28cad90e21ae04a0a5852901fc > Author: Andy Wingo > Date: Thu Aug 24 11:41:15 2023 +0200 > > define-inlinable marks residualized procedure as maybe-unused > > * module/ice-9/boot-9.scm (define-inlinable): > * module/srfi/srfi-9.scm (define-tagged-inlinable): Add maybe-= unused > declaration. Also require at least one body expr, otherwise t= he > metadata declaration could escape as the proc body. > > So it looks like this is not in any released version yet. And indeed,= when I > try to compile it using the current master, the warning goes away. > > I wonder how to work around it in the mean time. I guess I could just= put > %foo?-procedure as a top-level expression. This seems to not produce = any > warnings: > > (define-module (x) > #:use-module (srfi srfi-9) > #:export ( > foo? > make-foo)) > > (define-record-type (make-foo) foo?) > %foo?-procedure > > I guess there should be pretty much zero performance impact, correct? = Are there > any side effects I might not be aware of? > >> >> I don't have a computer this week so I cannot try your code. Sorry. > > No worries, you were helpful already, enjoy your no-computer time :) > >> >> -- >> Linus Bj=C3=B6rnstam >> >> On Wed, 5 Jun 2024, at 17:02, Tomas Volf wrote: >> > Hello, >> > >> > I am getting following warning from a guild compile: >> > >> > warning: possibly unused local top-level variable `%foo?-proced= ure' >> > >> > And I am not sure how to tackle it. This is my full source code: >> > >> > (define-module (x) >> > #:use-module (srfi srfi-9) >> > #:export ( >> > foo? >> > make-foo)) >> > >> > (define-record-type (make-foo) foo?) >> > >> > When I try to compile it: >> > >> > $ guild compile -W 3 -o x.go x.scm >> > x.scm:7:0: warning: possibly unused local top-level variable >> > `%foo?-procedure' >> > wrote `x.go' >> > >> > I would (for obvious reasons) like to keep my compilation warning-f= ree. I can >> > think of two approaches: >> > >> > 1. Export the %foo?-procedure >> > I think this would confuse downstream users, since they are no= t expected to >> > use it directly. >> > >> > 2. Mark the procedure as used >> > In C I could use `(void)proc;', is there an equivalent of tha= t construct >> > in Guile? >> > >> > Are there other options? How are you approaching it? >> > >> > Thank you and have a nice day, >> > Tomas Volf >> > >> > PS: I am not even sure why this warning happens, the `foo?' syntax = transformer >> > is exported and *does* reference it (as far as I can tell from ,exp= and). >> > >> > -- >> > There are only two hard things in Computer Science: >> > cache invalidation, naming things and off-by-one errors. >> > >> > Attachments: >> > * signature.asc > > Have a nice day, > Tomas Volf > > -- > There are only two hard things in Computer Science: > cache invalidation, naming things and off-by-one errors. > > Attachments: > * signature.asc