From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id yIHjE1N+imS96AAASxT56A (envelope-from ) for ; Thu, 15 Jun 2023 04:58:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id mOnTE1N+imQDOwEAauVa8A (envelope-from ) for ; Thu, 15 Jun 2023 04:58:27 +0200 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 0E7AC47C04 for ; Thu, 15 Jun 2023 04:58:21 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q9dBT-0004oZ-ML; Wed, 14 Jun 2023 22:58:03 -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 1q9dBS-0004oF-7U for bug-guix@gnu.org; Wed, 14 Jun 2023 22:58:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q9dBR-0004D7-Q0 for bug-guix@gnu.org; Wed, 14 Jun 2023 22:58:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q9dBR-0001wD-LC for bug-guix@gnu.org; Wed, 14 Jun 2023 22:58:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#62287: Ungexp inside vector problem Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 15 Jun 2023 02:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62287 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Josselin Poiret , 62287@debbugs.gnu.org Received: via spool by 62287-submit@debbugs.gnu.org id=B62287.16867978457336 (code B ref 62287); Thu, 15 Jun 2023 02:58:01 +0000 Received: (at 62287) by debbugs.gnu.org; 15 Jun 2023 02:57:25 +0000 Received: from localhost ([127.0.0.1]:45851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q9dAr-0001uG-0k for submit@debbugs.gnu.org; Wed, 14 Jun 2023 22:57:25 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:50429) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q9dAp-0001ty-Ai for 62287@debbugs.gnu.org; Wed, 14 Jun 2023 22:57:24 -0400 X-GND-Sasl: andrew@trop.in DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1686797837; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=v8gI7mhqqyM3q4GnRLu3kiJUy4Y45tVlmsSxRjBkd7A=; b=NQmk1vzP5NkeVmcYQutcBPZ6MY9/kHqs613y75jZc/OFOPErQxQR9zyK9vFoBCXIfRJbkN j8bverywkpc1isLCvM8AIjUWsvIabEhG7vW9/vxexrO64b66fdPz+xZqIxWYI2twzH0coi zku2cmCU1YjqMouKQx52cvKIx2w9reft4oJNGqkeT/MmQsCyqAf4Lac//N+CNHIxQJGKMW VEhKyjCSoDgBQDq1M1AzyREBKrNNj3NkbfzJMrLssuIzuQJItL/TxamVj7F6U3k9ljNAJ5 F7ZFp3GiL4i3dcG9BvbRfv0LXPEZ12fOsoOci9TDbOgtvlu6uCpKw3VprNcxiQ== X-GND-Sasl: andrew@trop.in Received: by mail.gandi.net (Postfix) with ESMTPSA id B3441240004; Thu, 15 Jun 2023 02:57:16 +0000 (UTC) From: Andrew Tropin In-Reply-To: <875yavsnuw.fsf@jpoiret.xyz> References: <87v8iw3rbg.fsf@trop.in> <875yavsnuw.fsf@jpoiret.xyz> Date: Thu, 15 Jun 2023 06:57:12 +0400 Message-ID: <87edmdh1pz.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1686797902; a=rsa-sha256; cv=none; b=sv7xf2XXp89kRC2j5KHA/gUVPfmSgmhYckPGv73MYDzfwYxyypt1FCFTjD0odXwRZz9ofu cuLUAjdkuz/yhW9wsqR4zFrvlZQYu/kXPNDolw2JzzOkX+lkLXVLZWW6cfwx26/i3XuKhs /WoWHgF+idzhC4xucfAPR2VNvDXgHjfYCpjGy6MdltXPgLWjHVkVjM0cN5v2UUwd2EhMBx UWcmhYAI1ZoGrn2I60t2sFF5wzS1qajn7J60aOVm7Zv/dnrUsHXtI3tRf2c1iFo0WX9dW7 JovQTD00+aC7U3gxrujoASHSbQ14dKxjA/RWtv86g8sNUU0k3VpyNVal5ODC0A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=NQmk1vzP; dmarc=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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1686797902; 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=v8gI7mhqqyM3q4GnRLu3kiJUy4Y45tVlmsSxRjBkd7A=; b=uKy4xKfoiFQJp0xfLsRrqDRki/yV2cTZQNIOJgrkR7gmmYkYV5tq5G1DTWwB0tinxjLWyI ar4ABJ/E0056oi7/JPS3s+Tp3miVHvRv0DM4XAy1XH4LkJIFb+oUR761xLGpg3hcjEPeHW WB3Yi1Tfolfd35WbDwQAcLv93oeedTPbnKFMNHD+NZKGCZHJuxhKhilhfD15VqurIMxosc HBadGcgpE4GGeMSSn5PyNCbTNs+qvXocXtcNUeHgZLmk4dMNhz7MWa5aYPzfvj/pWOHnKL brxM4hU+hrkqGLigmcaVVBR997O/JLkwor/A6uOilRzL8QV/drB62D2t8Kv8zA== Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=NQmk1vzP; dmarc=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-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -4.23 X-Spam-Score: -4.23 X-Migadu-Queue-Id: 0E7AC47C04 X-TUID: TtTPgGQhTNbj --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On 2023-03-20 11:45, Josselin Poiret wrote: > Hi Andrew, > > Andrew Tropin writes: > >> I would expect two last expressions return the same result, but the >> former one doesn't do ungexp: >> >> --8<---------------cut here---------------start------------->8--- >> (define a '(3 4)) >> >> (define b `#(1 2 ,a)) >> >> (eval-with-store >> #~(list '(1 2 #$a))) ;; =3D> ((1 2 (3 4))) >> >> (eval-with-store >> #~(list #(1 2 #$a))) ;; =3D> (#(1 2 (ungexp a))) >> >> (eval-with-store >> #~(list #$b)) ;; =3D> (#(1 2 4)) >> --8<---------------cut here---------------end--------------->8--- >> >> Am I doing/expecting something wrong or there is a bug here? > > It's more related to how the guile reader works, and this is such a > corner case that I don't know whether we should fix. Basically, > anything starting with # is a reader extension, and the next character > identifies which extension it is. #( is the reader extension for > vectors, #~ for gexp and #$ for ungexp. > > To simplify, whenever you use #~, guile will insert (gexp ...) instead, > which is a hygienic macro (not just a procedure!), that will look for > ungexps inside the expression. That traversal is only made on cons > cells though, so it doesn't try to go through any piece of syntax that > is not a cons cell! Since #( doesn't expand to a (vector ...) > cons-cell, the subexpression gets ignored for traversal. > > This is in contrast to another reader extension, #' (for syntax), which > does expand to (syntax ...), and is thus further traversed! > > You can find how both of these reader extensions operate in > . > > I guess the immediate fix is to use (vector ...) rather than #(...). We > could also add code to the gexp traversal to also traverse vectors, but > I am not even sure if they go through the gexp->sexp dance unharmed, and > we also should in principle do that for everything that can get into a > gexp, not just vectors (eg. bytevectors). > Thank you very much for extensive explanation! I have a few tasks related to the guile reader extensions, so when I get my hands dirty with it, I'll probably share my new thoughts and opinions on this topic. =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmSKfggACgkQIgjSCVjB 3rC66A//WKBxTBLKv9zB80gtSCAG/D5IB8fidUHVPc22ih+t7Yi4MreNBOp4Oce9 O/0pbc/rolBfpm1CrYnX/Ug/j10miq7gpwZYKR6neO2iS6zpMee/hta2RBgCHGSS toBBLk+D+mUdWNk70vy1ZKXxPPBVw8pYA1yZ0YusPvTuy83CPAq8HbFgj6RK3iAB QGxjui+XCUP9vYUZGsCk1YlVbN9E1qGWxfbxvEXudB1XuZ1widj+SxRN0i1Arq5n cmPUq0+rI/Bq7247myIKDolCcAOEumqJttsM+Mw9pD28e1CI6EiYxxD/adxrM8NQ /7eEeiLzsR3Sj4SC9uOlDoEreiAbUCU+Wy4bencDBn8Vv07MkeOzriu/+qgxCSr0 P9WnjdU/qGmHQ0aZLTcRFEhbwQgKh2Em/hmheC1qtffGn46GMVHGKdzRyLEsM3Kg y0SWMgh1qwv/ELQUVACLcoLtdGX0ibzBBfY8IMHboF6Kes8AeQW45DcBtW2N76TB xkH/qMVBgJDzBgZauQT9vs7/mQEwrD+Qawkx9hrSBa0/1nZjVTkBo9w2nTro5Zx/ 4LP60t7klfpbzSXS1sQc9TWUj5qCzMDIg2953t6UrtCeup4sjltPyGvqriFKF1mX L3VM5cOvAoTkQal4JSYzLdfDEU8FmKE0mBXsKrdIagzqA9UbHt8= =yxjj -----END PGP SIGNATURE----- --=-=-=--