From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 0jUgAA3MN2EqkwAAgWs5BA (envelope-from ) for ; Tue, 07 Sep 2021 22:31:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id QC/XNgzMN2GCIQAAB5/wlQ (envelope-from ) for ; Tue, 07 Sep 2021 20:31:08 +0000 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 A11EA691F for ; Tue, 7 Sep 2021 22:31:08 +0200 (CEST) Received: from localhost ([::1]:47948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNhkJ-0002mc-QH for larch@yhetil.org; Tue, 07 Sep 2021 16:31:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNhkE-0002mN-K8 for guix-patches@gnu.org; Tue, 07 Sep 2021 16:31:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46372) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mNhkE-0005hV-BD for guix-patches@gnu.org; Tue, 07 Sep 2021 16:31:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mNhkE-0003IQ-4W for guix-patches@gnu.org; Tue, 07 Sep 2021 16:31:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50286] [RFC PATCH] Let 'package-location' returns location of surrounding 'let'. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 07 Sep 2021 20:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50286 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: iskarian@mgsn.dev, 50286@debbugs.gnu.org Received: via spool by 50286-submit@debbugs.gnu.org id=B50286.163104665812660 (code B ref 50286); Tue, 07 Sep 2021 20:31:02 +0000 Received: (at 50286) by debbugs.gnu.org; 7 Sep 2021 20:30:58 +0000 Received: from localhost ([127.0.0.1]:57918 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNhkA-0003I8-0X for submit@debbugs.gnu.org; Tue, 07 Sep 2021 16:30:58 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:57622) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNhk6-0003Hy-Rh for 50286@debbugs.gnu.org; Tue, 07 Sep 2021 16:30:55 -0400 Received: from butterfly.local ([188.188.3.227]) by baptiste.telenet-ops.be with bizsmtp id r8Ws250074tskic018Wts0; Tue, 07 Sep 2021 22:30:53 +0200 Message-ID: From: Maxime Devos Date: Tue, 07 Sep 2021 22:30:46 +0200 In-Reply-To: <875yvc4254.fsf_-_@gnu.org> References: <0b61652d751633f78e876a27be88ed14e47527b6.camel@telenet.be> <87o89681br.fsf@gnu.org> <875yvc4254.fsf_-_@gnu.org> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-zViYvh/gVZ0H+eiAVeW3" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1631046653; bh=O8/isCw4YaEIBPDYn9gqY7jzbTMSdFrVTwyccYBQ9F0=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=hy3yVFrXDmAh5reOa5cPDSHE6We8XaQFO8hS74Hir+m50gy5X5mryA0cWKcNuOnjE pSa3g08WusQ0uA0O/PU+wi9k/yU+YeKqqKUXfWm1jEKde6IjEBsEOB3tt1k+/pVrLw e1u/s9wzv+8qu45WxpPXOn0AmpodXqaQOgRUaHmVKPZ+uEs8ok2yYeF+lSHiicT7if EYSXD5VcWaLnV/g2Jxw6qkR06M7yisBqTHq8dmZwZhXRHUAomITtNuVpTGR9V6ZJEt EfTd7NSUSsc9VrekKILhXyCuQfuMd1IBcAyMPuXq3mUBKR+vGLczeqrafUrHtVyuj/ cEAa8WZvoe9gg== 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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1631046668; 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: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=O8/isCw4YaEIBPDYn9gqY7jzbTMSdFrVTwyccYBQ9F0=; b=KaRdimttxMckqRxap21Wxzm9sGhHiUITDqa+gCnNRf/1i5Q0vDb7abbDkbUD8bnK89RdG8 dyOiH62aXRcQO1xdeJkr9sEX8s6Efl8GC5Cl0FaMaOJ55CtEha2Pt+sf27UMhq2N8T7pI0 hWYq341RXB/KR36HXKo7GmEdlVyO3sZ8VJ8M5kup7WffuWf5XPFvxsOojFXel6YmtXMGBv pNfB27rdK48z5urFsMv0LDGda7W182hq07SdNoWp0a1GdVdkh8QX8zSO1TUCNc0lVHReu+ FNEAwb00R2lyO8kLP7UDXnuNh5HFZJFUY8fifpJsvDGk5k2zcgUjUbV+LL1jEA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1631046668; a=rsa-sha256; cv=none; b=EdZeYw1PCHe+mYGr/RciS3i1I4tZZ2ZhXyphbc11dv1Z9VXlkWd19fqr1UZGBZwyleC8/G rpNz0TjR6nrhCLQiSOXdcvDQbjtRjBbNARe1YOdPtnAwBddddNSf232YlBKPPVUYHNy6po OUjjIPi0MJr2VKFeYs3BN7UqrykqY65Oy2UTtRU5hCDFA5Wb1p4PSGXWBHg9tW/hNkUXFO x3CS52ygCb9hV2j2noGDAqv6EDR1QEcq8AL32wsctjsz6tAR/6aWxrboMzlg0W6q2ysLN6 2XRwjxfX9XBzJOPcillH2GuhZQI57fMVBk5T/DU8Fsn6lC5SxCBVUbuH1Fei0Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=hy3yVFrX; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.91 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=hy3yVFrX; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: A11EA691F X-Spam-Score: -1.91 X-Migadu-Scanner: scn0.migadu.com X-TUID: Spl95McLBc0b --=-zViYvh/gVZ0H+eiAVeW3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s schreef op di 07-09-2021 om 21:27 [+0200]: > Hi Maxime & Sarah, >=20 > Ludovic Court=C3=A8s skribis: >=20 > > Hmm, thinking out loud, what about this: use the same trick as you did, > > but replace =E2=80=98define-public=E2=80=99 instead of =E2=80=98let=E2= =80=99 & co., so as to be less > > intrusive. > >=20 > > (define-syntax-parameter current-definition-location > > (identifier-syntax #f)) > >=20 > > (define-syntax define-public* > > (syntax-rules () > > ((_ prototype body) > > (define-public prototype > > (syntax-parameterize ((current-definition-location > > (identifier-syntax (current-source-loca= tion)))) > > body))))) > >=20 > > Since there=E2=80=99s code that assumes =E2=80=98package-location=E2=80= =99 returns the location > > of the (package =E2=80=A6) sexp, we could add a =E2=80=98definition-loc= ation=E2=80=99 field in > > , defaulting to =E2=80=98current-definition-location=E2=80=99,= or tweak > > =E2=80=98location=E2=80=99 to include both. >=20 > Below is an attempt at doing this. As discussed on IRC, the first patch > switches the =E2=80=98location=E2=80=99 field to a more compact format th= at may reduce > load time by a tiny bit, though it=E2=80=99s hard to measure. > The second patch > introduces an extra field for the definition location; that means that > records now occupy an extra word, which is not great, but > unfortunately OTOH location is slightly smaller. Why not always let the location of a package be the location of the surrounding define-public* form, instead of having two separate locations? Letting the location of a package be the location of the define-public* form (or 'let' form) seems more useful to people using "guix edit minetest-etheral" for example, and the package-field-location code can easily be adjusted to support 'define-public*' (or let) forms. If two separate package-definition-location and package-location are introduced, what should "guix show minetest-ethereal" show? The location of the 'package' form, the location of the 'let' form or the location of the 'define-public' form? Having two separate define-public* and define-public macros might be a little confusing. Would it be possible to let 'define-public*' replace 'define-public'? I don't really have an opinion on whether package-[field-]location should return the location of the 'let' form or the location of the 'define-public= ' form. I think 'package-location' should return the location of the 'let' form (or a surrounding form), because the 'commit' and 'version' variable from the 'let' form are part of the package -- change them, and you'll get a different package. Greetings, Maxime --=-zViYvh/gVZ0H+eiAVeW3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYTfL9hccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7lUfAP90HuCMjv/r9CoFps7NLhTTkbBt rZyD1mnP+UjsvRJRMgEAt4Qx1hNWUMtSBoEAQMMOZ/k9bLWvZwv+j5vpN+DQDQY= =npA2 -----END PGP SIGNATURE----- --=-zViYvh/gVZ0H+eiAVeW3--