From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id MHrcMjpKHWYHVQEAqHPOHw:P1 (envelope-from ) for ; Mon, 15 Apr 2024 17:39:38 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id MHrcMjpKHWYHVQEAqHPOHw (envelope-from ) for ; Mon, 15 Apr 2024 17:39:38 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=NsruURYw; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1713195578; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Lzhqu2e+cAy1Td6udzgnsfK/iejWG8dEsKU670jPODA=; b=lsrSINBjl1orAvCSyKI27mz8EPmCSmYDXThiGV76gMFc5kmaIIr7KEpb2bAzcKtfNimH5x cCGACL5as2hTL09QVxDUwy6LP0y9UrDa4cLSHud0ixwOAQSIgkn9gHs9jyczuaPwwvRcYw JqGV8jmA0XGWTolW266JKc3UXDgAxLZCdBOQKqD80SBUzsmADPX2TbczBm0M1wKNbwXYvM 6uh7EFvDJJJMaTIVjyd00J8MU1Dg28pzHPFN0dDfegQagnWPXQsIuz1tMH9QYVvkkedV8i fHTTqHrfXz2mBpE4ycdF2UpyRdsH0cS61fAWrRst+NiH9KvScqI9nQHeuilhGw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=NsruURYw; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1713195578; a=rsa-sha256; cv=none; b=mzVTYVEvA4YT7+fOZTmpbAEyT8QXBOG9OYJvLBAC/S0VzRFGQMy7xx2uCZASPfndHYigYv 1NQ+SPXKjPSYyVEuXqTLCJ0dTNQ/BklidBuOAWt4FaK1XzUstN0wt6DWehOGuUI7r0ifLU R0IKojVoglrGO9MyplOQXpEiqPMJwjpRh6L/bgGBGPlNEw5My57d5JxGTu2BeRnRPpTA/p SU9yNDJlFI9NYA6boDFjiHx/e4Um4mWCZndBP2zaJ0m42DsIQtUV1NH+afyBBX9lm7RXgQ 68yVdfC+v/RGzVoENeiZ1nUTYuicbugC2FeZ0Ym7xqPqUuKmLR+ED625AlHN0g== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BD33DBCD0 for ; Mon, 15 Apr 2024 17:39:38 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rwOQ4-0006J6-Ts; Mon, 15 Apr 2024 11:38:56 -0400 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 1rwOQ4-0006IZ-8l for guix-patches@gnu.org; Mon, 15 Apr 2024 11:38:56 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rwOQ3-0001da-W7; Mon, 15 Apr 2024 11:38:56 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rwOQC-00080X-Ts; Mon, 15 Apr 2024 11:39:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70398] [PATCH 4/5] packages: =?UTF-8?Q?=E2=80=98define-public=E2=80=99?= replacement calls =?UTF-8?Q?=E2=80=98module-export!=E2=80=99?= directly. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 15 Apr 2024 15:39:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70398 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70398@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 70398-submit@debbugs.gnu.org id=B70398.171319550330438 (code B ref 70398); Mon, 15 Apr 2024 15:39:04 +0000 Received: (at 70398) by debbugs.gnu.org; 15 Apr 2024 15:38:23 +0000 Received: from localhost ([127.0.0.1]:37904 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwOPV-0007uO-Jq for submit@debbugs.gnu.org; Mon, 15 Apr 2024 11:38:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41180) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwOPG-0007q2-NG for 70398@debbugs.gnu.org; Mon, 15 Apr 2024 11:38:08 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rwOOz-0001UY-K6; Mon, 15 Apr 2024 11:37:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=Lzhqu2e+cAy1Td6udzgnsfK/iejWG8dEsKU670jPODA=; b=NsruURYwoStjrRLCluVZ MIxXquM/bL6MgDIRt+4s32RyGpCghD4xXDbetl/XkmjKMrmsCxShIgVB+mEYGiYEv4SHvRKC0E0m7 4yUr2LqKMNGcA0usT0/bRE3/l1aP/eurDYRLZuhbS92jCmXLef9a+ZebN85qWUcV77XnkOoKNhAqm jKYxpJQWbWHtXfOSaXU+hpdQN2aWyNstvmFRL/EGpHAFE33bo1Pn2eCS4So5tZ+RxsIGKy+Fm8nHc DBGKeo2CBU4wfMUeQ/20+i8x3j8i2/Z8yXeMusy8abmdJJ8rOcbwp3cEipCU7mVXXhjIodVNx2gqp pWhs63OL/RgStw==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Mon, 15 Apr 2024 17:37:06 +0200 Message-ID: <723be7e4e70628f32862b8c1043eee641c4ccf8c.1713194148.git.ludo@gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -3.07 X-Migadu-Scanner: mx11.migadu.com X-Spam-Score: -3.07 X-Migadu-Queue-Id: BD33DBCD0 X-TUID: vOryq59zM5hM This reduces code bloat and loading overhead for package modules, which use ‘define-public’ extensively. * guix/packages.scm (define-public*): Use ‘define’ followed by ‘module-export!’ directly instead of ‘define-public’. Change-Id: I7f56d46b391c1e3eeeb0b9a08a9d34b5de341245 --- guix/packages.scm | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/guix/packages.scm b/guix/packages.scm index bd6724cdd4..6c697bcc67 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -482,7 +482,8 @@ (define-syntax-parameter current-definition-location (define-syntax define-public* (lambda (s) "Like 'define-public' but set 'current-definition-location' for the -lexical scope of its body." +lexical scope of its body. (This also disables notification of \"module +observers\", but this is unlikely to affect anyone.)" (define location (match (syntax-source s) (#f #f) @@ -499,10 +500,21 @@ (define-syntax define-public* (syntax-case s () ((_ prototype body ...) - #`(define-public prototype - (syntax-parameterize ((current-definition-location - (lambda (s) #,location))) - body ...)))))) + (with-syntax ((name (syntax-case #'prototype () + ((id _ ...) #'id) + (id #'id)))) + #`(begin + (define prototype + (syntax-parameterize ((current-definition-location + (lambda (s) #,location))) + body ...)) + + ;; Note: Use 'module-export!' directly to avoid emitting a + ;; 'call-with-deferred-observers' call for each 'define-public*' + ;; instance, which is not only pointless but also contributes to + ;; code bloat and to load-time overhead in package modules. + (eval-when (expand load eval) + (module-export! (current-module) '(name))))))))) (define-syntax validate-texinfo (let ((validate? (getenv "GUIX_UNINSTALLED"))) -- 2.41.0