From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id KI7GHiPV0mFOwgAAgWs5BA (envelope-from ) for ; Mon, 03 Jan 2022 11:51:15 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id SAdAGyPV0mFOAQAAauVa8A (envelope-from ) for ; Mon, 03 Jan 2022 11:51:15 +0100 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 C48D323F4C for ; Mon, 3 Jan 2022 11:51:14 +0100 (CET) Received: from localhost ([::1]:54606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4Kvp-0006to-NV for larch@yhetil.org; Mon, 03 Jan 2022 05:51:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4Kve-0006tR-CO for bug-guix@gnu.org; Mon, 03 Jan 2022 05:51:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:50911) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n4Kve-00066Z-2Y for bug-guix@gnu.org; Mon, 03 Jan 2022 05:51:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n4Kve-0004yr-0r for bug-guix@gnu.org; Mon, 03 Jan 2022 05:51:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#52749: G-expressions don't consistently preserve #nil Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 03 Jan 2022 10:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52749 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Philip McGrath , 52749@debbugs.gnu.org Received: via spool by 52749-submit@debbugs.gnu.org id=B52749.164120700419048 (code B ref 52749); Mon, 03 Jan 2022 10:51:01 +0000 Received: (at 52749) by debbugs.gnu.org; 3 Jan 2022 10:50:04 +0000 Received: from localhost ([127.0.0.1]:34219 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n4Kuh-0004xA-Fz for submit@debbugs.gnu.org; Mon, 03 Jan 2022 05:50:03 -0500 Received: from andre.telenet-ops.be ([195.130.132.53]:48162) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n4Kuf-0004wf-0X for 52749@debbugs.gnu.org; Mon, 03 Jan 2022 05:50:02 -0500 Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by andre.telenet-ops.be with bizsmtp id eApy2600S4UW6Th01ApyTR; Mon, 03 Jan 2022 11:49:59 +0100 Message-ID: <7ec439e7e4115ce927f7d1a87b2663d5468304cc.camel@telenet.be> From: Maxime Devos Date: Mon, 03 Jan 2022 10:49:53 +0000 In-Reply-To: References: <23d2ac1d-737d-787c-5535-c816566461dd@philipmcgrath.com> <6211bc6e48fa8f5dcf8711bba186812f3a5e52c4.camel@telenet.be> <637bb8909bd524ce239d66cc73d1e5ad43ce2ea9.camel@telenet.be> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-MLL5WgtVIyjHj8FwQNih" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1641206999; bh=PPfG0UQkN8RKJZs0tV7/fGeT5Mpzx+E6Ze+aXls0+hk=; h=Subject:From:To:Date:In-Reply-To:References; b=BgXWLaLH1I6S4rEtxsqJ3ZpTaP6hCbtfVbEMRGniUbYr2BlGo/lvpwp6GACZe4TcH leZWhnWZNp8kypxHpe5A+rg+yagGSKivkwBW6PCXnN9pc+iJrNvtXLaAYybRH/FPLC T48jjQqsM/gupXGxv4/CPCj7+Lpq9Ldf50njCLCSKi8sQV8az6EbfejEX0Zas6518a PJ+2GA8Rv4LL7hH2uuUf4PYYDOX5dgVqwubI5qmyUUaWwUjsVt7vDZT+hYcU+Ef8xe BtksXS5jC7yNPyo+P9Po0nBE1x17DDVrh7fVhEwejYZ+MAzw63yIISH8tR0No+YLCC kc2o+rum4uBAg== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1641207074; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=PPfG0UQkN8RKJZs0tV7/fGeT5Mpzx+E6Ze+aXls0+hk=; b=elA8umYIY3TNnodHbOCenPdjEuWFeVYTXMlAG5Wi8OblGi1j+k/o0R7IC6WTdV2jXd0ee6 lamquqkWZ26WXQJXRA14JNpeHmS/4bbIJlpVGBnlEoJvKxrR4q1VF356mYyGu5/gSWoFDx rdEzw4my9G77vFpHALDmR3E1ocFwsWnjGmtesCz/XyztNYhEgTBujvBUjJET0HQDsFCeg5 EXQNw8OJ6EVK7+LlbFx7NJV1wP0IVno8SumPc3fkPXNtxL0x0e5xJ1UdbqiRlHhjPMp+rW CLCkaITK3Gcat3lUHsck6aD5dmml8sf0Rkro18F7FVV23Jwc8Fvaf8QXWNumuQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641207074; a=rsa-sha256; cv=none; b=OQpmxNN8DzD47b/Iqeiu6Wq3InvHqY7k/h87cYN5pvphsZkWnovoZZOLYs9mpMilMgsyrr /qjzV5sK4xBtZmFiGy6S1ZGbFkcUmHbBb4YiTzyHpHTX1Zs1r5EM1/XF9mN7tTYnCFiSzk w4u4Dm0G7yPozy4QAuf2XEJpC3XDqrTvdKqLpuJ4QfVX9hjk6OWWuJoxJ8n+GSV07TRbst eF+HBKwcS7uLBDT8rtXrYHhUe7b21PDdEjKDo/DkW+w9aiDI3D+DVbzTBrV3U9DzK59WvA 05SL1RCmrQ3/0QWKD3w1HipFedpXJtkalBsFpfhFfLclBwC+KBHJYBVrEOa+uQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=BgXWLaLH; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -4.19 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=BgXWLaLH; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: C48D323F4C X-Spam-Score: -4.19 X-Migadu-Scanner: scn1.migadu.com X-TUID: 2pOVbdIHbcer --=-MLL5WgtVIyjHj8FwQNih Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Philip McGrath schreef op ma 27-12-2021 om 13:38 [-0500]: > I haven't looked at the implementation at all, but extending `write`=20 > certainly would be a reasonable option, and, longer-term, it might be=20 > possible to upstream a patch adding the needed behavior. Not sure what the API should be (an optional argument #:preserve-nil? #true? A parameter nil-writing-style? A procedure 'write-preserving- nil'?), but sure. > A more radical option could be to use a format other than plain-text=20 > s-expressions for compiled G-expressions. For example, Racket has a=20 > forward-compatible "fast-load serialization" binary format for the kinds= =20 > of values that can be embedded in compiled code.[0] There are obvious=20 > disadvantages to a binary format, but advantages include the ability to= =20 > preserve source-location information and to avoid some the quirks that= =20 > come with functions like `write` and `read`, for historical reasons or= =20 > for the convenience of humans writing code directly. The implementation= =20 > is in Racket, so it should be fairly easy to port to Guile, if that were= =20 > wanted.[1] The primary purpose of that data format appears to be able to load S-expressions _fast_, which seems less useful in Guix because every derivations are only built once (ignoring GC and build failures). More important in Guix, is being able to _write_ G-exps fast. Though perhaps fasl can be written fast? Anyway, this fasl format might be one way to represent preserve information. jpoiret on #guix was interested in preserving position information, see . > Or maybe there's something related to Guile bytecode that=20 > would work, or maybe just making a `#nil`-preserving version of `write`= =20 > would be easier. The G-exp machinery doesn't compile things to bytecode, because the bytecode format changes between Guile versions and for bootstrapping, old Guiles are used (from the 2.0 series IIRC). Also, this can lead to world-rebuilds whenever an optimisation in guile is added or tweaked. Anyway, I think that in the short term, it would be easiest to modify (guix build json) to not use #nil (though that would lead to rebuilding all rust and node stuff because it is used in cargo- build-system). Longer term, maybe '(guix build json)' could be eliminated and we could use (json) from 'guile-json' instead, like documented in the manual ((guix)G-Expressions): =E2=80=98In the same vein, sometimes you want to import not just pure-Sc= heme modules, but also =E2=80=9Cextensions=E2=80=9D such as Guile bindings to C = libraries or other =E2=80=9Cfull-blown=E2=80=9D packages. Say you need the =E2=80=98gui= le-json=E2=80=99 package available on the build side, here=E2=80=99s how you would do it: (use-modules (gnu packages guile)) ;for 'guile-json' (with-extensions (list guile-json) (gexp->derivation "something-with-json" #~(begin (use-modules (json)) ...)))=E2=80=99 Greetings, Maxime. --=-MLL5WgtVIyjHj8FwQNih 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+4iGRcl7gUCYdLU0RccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7pG4AP0feD6y+Er4BeBoDjOhKfBybZ5W U6KBOKMlRxxtI0UOkgEA3GXdGgjWjhI/m+QL30aZfhMHBNl2ihSvCKy3XUA2JAE= =kTxC -----END PGP SIGNATURE----- --=-MLL5WgtVIyjHj8FwQNih--