From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrew Tropin Newsgroups: gmane.lisp.guile.devel Subject: RE: [BUG] Eval sets incorrect runtime metainformation Date: Wed, 26 Jun 2024 15:41:45 +0400 Message-ID: <87tthgj5hi.fsf@trop.in> References: <87bk3pkqmt.fsf@trop.in> <87msn86ops.fsf@igalia.com> <20240626113611.g9cB2C0023K6y2F069cBEe@michel.telenet-ops.be> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5778"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Maxime Devos , "guile-devel@gnu.org" To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Wed Jun 26 13:42:12 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 1sMR2R-0001DR-Ok for guile-devel@m.gmane-mx.org; Wed, 26 Jun 2024 13:42:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMR2D-0003rq-Op; Wed, 26 Jun 2024 07:41:57 -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 1sMR2B-0003rJ-2N for guile-devel@gnu.org; Wed, 26 Jun 2024 07:41:55 -0400 Original-Received: from out-183.mta1.migadu.com ([95.215.58.183]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMR28-0005K6-Lz for guile-devel@gnu.org; Wed, 26 Jun 2024 07:41:54 -0400 X-Envelope-To: wingo@pobox.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=key1; t=1719402110; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wSwJxC2dreOywzyaHQXPQXRyvkeTFOw9VEFhdXTOev0=; b=oRSlw2Nglz/i7jvGG88UygIM/RlYjm2d8tjOBxsqHT+OgSKpJOj4eGxK7Tzla0/kAdOCm3 +dyOORT7x0Bw49qdU/qqQnrxAIcc6X49fFDp7f2OD3El1W2XIcLBRpMhOPRuzFzaNvM9IR 4b9YpqiypJF3kDP2pE2v+W83gnaT96WL77sLXzLZELnBRmZ9Vk/sPjM2NZ7vRVXBeEqWBW qtdukyXI4YRW9BuCwXhfvjTmn49SWi2BHzRBR67ctpbArasRyZKSuGBA2ySfzzOFunlsfX 7IEN+VVHq8rfCUHOWiBvDxOJjw+TXQMO6yocNYbvnAdsS4rFdyb74y1cdRUMDw== X-Envelope-To: maximedevos@telenet.be X-Envelope-To: guile-devel@gnu.org X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-Reply-To: <20240626113611.g9cB2C0023K6y2F069cBEe@michel.telenet-ops.be> X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=95.215.58.183; envelope-from=andrew@trop.in; helo=out-183.mta1.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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:22482 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2024-06-26 11:36, Maxime Devos wrote: >>> (use-modules (system vm program) >>> (ice-9 eval-string)) >>> >>> (eval-string "(define (test-fn) 'hey)" >>> #:file "hello.scm" >>> #:line 1 >>> #:column 1 >>> #:compile? #f) >>> >>> (format #t "~a\n" (program-sources test-fn)) >>> ;; ((0 ice-9/eval.scm 329 . 13) (12 ice-9/eval.scm 330 . 21) (44 ice-9/= eval.scm 330 . 15)) > >>What you are seeing here is that in general the debugging experience is >> different for interpreted and compiled procedures. For example, you >> will not be able to set a breakpoint in interpreted code, because the >> code for the closure that is part of `eval` corresponds to potentially >> many different functions. program-sources will only work usefully on >> compiled procedures. >>https://www.gnu.org/software/guile/manual/html_node/Compiled-Procedures.h= tml. > > 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. > > Likewise for arity and procedure name. > > (*) Looking at > https://www.gnu.org/software/guile/manual/html_node/Procedure-Properties.= html, > it appears the documentation doesn=E2=80=99t actually document what the > =E2=80=98source=E2=80=99 property is for =E2=80=93 It could be interprete= d in multiple ways > currently. > >>I would suggest that if you are working on a rich IDE, that you pass >> #:compile? #t. Nothing else will work as you like. I do pass (use compile directly to be more precise) :) but there is another very important problem related to this approach: https://yhetil.org/guile-devel/20240621164008.eEg72C00D1xd29F01Eg7DF@baptis= te.telenet-ops.be/T/#t It also leads to problem with define-once, which sets the value to # in most cases, when "evaluated" with compile. > > Something else will work as well: adjusting =E2=80=98eval=E2=80=99 to set= procedure > properties or something like that. Agree with Maxime here, and that is what I propose in the original message. >> That said, the evaluator does attach so-called "meta-data" information >> to procedures, such as the procedure name. >> https://www.gnu.org/software/guile/manual/html_node/Procedure-Properties= .html. >> If you know that you are making a procedure you can insert some >> meta-data for use by your run-time, in an initial vector alist. See >> https://www.gnu.org/software/guile/manual/html_node/Procedure-Properties= .html. >> But that's limited and doesn't take macros, etc into account. Yep, that's is why I wrote: =2D-8<---------------cut here---------------start------------->8--- The another related problem is that the metainformation is stored in prodecures properties, but not in variables, which makes it impossible to implement a proper goto definition in general case. =2D-8<---------------cut here---------------end--------------->8--- How hard is to make a generic metainformation, which is attachable to macros, symbols and other objects of the language, not only to procedures? >> That said, the evaluator does attach so-called "meta-data" information >> to procedures, such as the procedure name. >> https://www.gnu.org/software/guile/manual/html_node/Procedure-Properties= .html. >> If you know that you are making a procedure you can insert some >> meta-data for use by your run-time, in an initial vector alist. See >> https://www.gnu.org/software/guile/manual/html_node/Procedure-Properties= .html. >> But that's limited and doesn't take macros, etc into account. > > That=E2=80=99s the job of =E2=80=98eval=E2=80=99, not the user of =E2=80= =98eval=E2=80=99. Think the same, eval should respect information provided by reader and attach it to corresponding objects. =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmZ7/nkACgkQIgjSCVjB 3rBajQ//S/6gFpMTaxnM0y4rtHgtMsv5EjO5Sfl7oFQie9jiuFXHY0sofjiKWm3A NJpVWVHyr+EHTSgAkvTBBlCGleV1LIn2Kdiz4OO6+qoNQg4Wjz2JwFi8+G3Ql0nh lO/C15PTrn5ZSG3Z5fOvFIf1Bx4UU3NdUOXOIchs1Bfv/Rh9TO2x1viKu4jyze52 O209NZXeMyY2yTaxT40xm7tRQDaFU7b6KMeHxV5d5wIbwOIOTn3e9QVQogTJtc/c hAheiPpyJauRPrXiZ3GdBWsRM6g+lr/H5UROtAT+07fCuysVfPWS0w3qlI5RANH3 79MqQsVCAi288jUNxcjQli/82EUvaIVavW0bQTy0gUYshHcz5GJjKcmIJZxjqGN9 uYrGp0JCFv7kaNLRFUpEHzoYAR0XHYLtCN8qaMubV8HvmPKmxZWNd6dm6OPwKkiz KihNNNHoiornY+DgVhxQSui77WUP0GP5QJ9K/tcQJAxNvzseetrC4kgfF+qR5gTm FWA91jDFupJnNOYQkU0PawVg5Cgvaz3ecxKGoUShRG4h0FwQ9BaKNX9jzyhdVD15 5Jn9ORArp/1sxpyGZ3KdJvHvSW/RbeJNalafciUq9u62QdwmEwPFBuBmfX4VSpFC nnPPtynPhGs7tgZKHyDaWmyC1YGbj/tcpTJV8phFIreos7WPSv0= =b05z -----END PGP SIGNATURE----- --=-=-=--