From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: [BUG] Eval sets incorrect runtime metainformation Date: Wed, 26 Jun 2024 18:04:40 +0200 Message-ID: <87frsz7krr.fsf@pobox.com> References: <87bk3pkqmt.fsf@trop.in> <87msn86ops.fsf@igalia.com> <20240626113611.g9cB2C0023K6y2F069cBEe@michel.telenet-ops.be> 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="12640"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Andrew Tropin , "guile-devel@gnu.org" To: Maxime Devos Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Wed Jun 26 18:05:05 2024 Return-path: Envelope-to: guile-devel@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 1sMV8r-0002xx-12 for guile-devel@m.gmane-mx.org; Wed, 26 Jun 2024 18:05:05 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMV8c-00012v-FG; Wed, 26 Jun 2024 12:04:50 -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 1sMV8a-00012f-LP for guile-devel@gnu.org; Wed, 26 Jun 2024 12:04:48 -0400 Original-Received: from fforwardh2-smtp.messagingengine.com ([103.168.172.197]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMV8Y-0003ch-EQ for guile-devel@gnu.org; Wed, 26 Jun 2024 12:04:48 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfforwardh.nyi.internal (Postfix) with ESMTP id 2AC69292004C; Wed, 26 Jun 2024 12:04:45 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 26 Jun 2024 12:04:45 -0400 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=fm2; t=1719417885; x= 1719504285; bh=0wDs306Lh5cZK1mZmguhCm5kST7ioYHcoEf0sn0d3uY=; b=b vR/Bw2gAQ/7m9i4yNkwZ4VpqitciV1gQwUAY6HK+P6ZtTcvsSrjilYrlB9btWfFo Ug2ofLfyEVx8XQ0inKTQHr/BKvVmGa1HnOp2YDydZ58CiIpOSJthgLYEuzp86+F+ RjiJFjrW89b2ni5lzyQpN2Ey8O8SbySkvIqY8MsEguTgYszOwK1hrQMAs508+I7S uaoY6OK1iPNyb6us+dHfbE0zsiXrn9LaaDZyq8UuPMgqybrU6oK9VxWDpUg2qZKr QGe83j6PWspMGnOJ09xzXXow9TWqqe6xHMMKMJcu10LOxRw+32vLxquMpWLPSB0d t+GzG3Lybes5+0IhLfSxg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrtddvgdelkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufgjfhffkfgfgggtgfesthhqredttderjeenucfhrhhomheptehnugih ucghihhnghhouceofihinhhgohesphhosghogidrtghomheqnecuggftrfgrthhtvghrnh epkeekgfeiuedtgffhgedvheeiueduffetffejveejteejgfehhfehveejieffiefhnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepfihinhhgoh esphhosghogidrtghomh X-ME-Proxy: Feedback-ID: i0cba4195:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 26 Jun 2024 12:04:42 -0400 (EDT) In-Reply-To: <20240626113611.g9cB2C0023K6y2F069cBEe@michel.telenet-ops.be> (Maxime Devos's message of "Wed, 26 Jun 2024 11:36:11 +0200") Received-SPF: neutral client-ip=103.168.172.197; envelope-from=wingo@pobox.com; helo=fforwardh2-smtp.messagingengine.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_NEUTRAL=0.779 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:22489 Archived-At: On Wed 26 Jun 2024 11:36, Maxime Devos writes: > IIRC, the question wasn=E2=80=99t about debugging in general, it was about > source locations in particular. Surely program-sources (or, in this > case, procedure-source maybe?) (why are the procedures in this family > even named program-whatever, this prevents doing the same for > interpreted code later) could be adjusted to also work for =E2=80=98eval= =E2=80=99. For > example, =E2=80=98eval=E2=80=99 could set the =E2=80=98source=E2=80=99 (*= ) procedure property when a > closure is made. I think it's really valuable to imagine how things should be but if you are going to argue they should be different, you should first try to understand how they are. `program-sources` is a mapping from bytecode offsets to source locations. For compiled procedures we can make this mapping because each bytecode position has a single source. For interpreted procedures, what you end up getting is the bytecode-to-source mapping *for eval*, not for the code being interpreted. Is it a great thing that there is a debugging (I use the term on purpose to mean all kinds of run-time reflection etc) difference between eval and compile? No, of course not. I would rather there not be a difference and not have to document something that is at best extraneous. There are differing pressures on eval: for bootstrap times (and macro expansion time) you want it to have the least amount of overhead possible, whereas for debugging you want to attach meta-data that isn't strictly needed at run-time. Attaching that meta-data has memory and time overheads. If we are looking to get the source location *just of the interpreted closure* -- that is possible; see eval.scm:581, there you would attach some other properties. You would have to define a different debugging interface that looks for source location information in a way different from program-sources. For me it's not worth it but I encourage you to experiment with (ice-9 eval); it's just another Scheme program. (You would need to take a different approach to memoization, in order to pass through source location information.) Andy