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: Fri, 28 Jun 2024 17:20:28 +0400 Message-ID: <87bk3l6w6b.fsf@trop.in> References: <87bk3pkqmt.fsf@trop.in> <87msn86ops.fsf@igalia.com> <20240626113611.g9cB2C0023K6y2F069cBEe@michel.telenet-ops.be> <87tthgj5hi.fsf@trop.in> <36db048b-2465-4088-b46c-b20e24cd0b66@philipmcgrath.com> 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="14762"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Maxime Devos , "guile-devel@gnu.org" To: Philip McGrath , Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Fri Jun 28 15:21:26 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 1sNBXY-0003dr-9o for guile-devel@m.gmane-mx.org; Fri, 28 Jun 2024 15:21:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNBX3-0004B8-U9; Fri, 28 Jun 2024 09:20:53 -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 1sNBX0-0004Ah-Qb for guile-devel@gnu.org; Fri, 28 Jun 2024 09:20:51 -0400 Original-Received: from out-186.mta0.migadu.com ([2001:41d0:1004:224b::ba]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNBWy-0001VD-3p for guile-devel@gnu.org; Fri, 28 Jun 2024 09:20:50 -0400 X-Envelope-To: philip@philipmcgrath.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=key1; t=1719580838; 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=nav9otB+upEAhkTIzYzEt87/pQVV7u7+IuJr/CtFzC4=; b=BgdEczu+JEDhuJZhoMtKlYbfqEEccQklupLtd6wPdNN6JBypeiSIGT4N6BNeLNav2pFbqf stCGG9FBWkm3m839DkQ/zKLhy1vNuPg4+2SplPs1MlNPnN7OcWKUvFJtfkuMTlXe2IT2Qq 8kI0xPr6xaCs+eSZCRAs/Qvb6pEq2Kxi9IsTdgYaFpMbi0Yh2FX+Nn0w05dbhRRBp0dQtX OtYN15CG7rkZMbQBRa5igI4ZcG0Z5Lp5BZtd9CCJWbqhQeI3xqbXQTXYQDqx4e7Hi8S3Tg gMK0Y9NUObprLIQ0eAkXAPVNH9xzJnxJKYdL3gzwsLwNeCBGQhUo77M1B9dNJA== X-Envelope-To: wingo@pobox.com 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: <36db048b-2465-4088-b46c-b20e24cd0b66@philipmcgrath.com> X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:1004:224b::ba; envelope-from=andrew@trop.in; helo=out-186.mta0.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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:22491 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On 2024-06-26 18:06, Philip McGrath wrote: > On 6/26/24 07:41, Andrew Tropin wrote:> >>>> 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-Properti= es.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-Properti= es.html. >>>> But that's limited and doesn't take macros, etc into account. >>=20 >> Yep, that's is why I wrote: >>=20 >> --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. >> --8<---------------cut here---------------end--------------->8--- >>=20 >> How hard is to make a generic metainformation, which is attachable to >> macros, symbols and other objects of the language, not only to >> procedures? >>=20 > > Instead of run-time reflection on values, I think an IDE implementing=20 > jump to definition should use source location and binding information=20 > from syntax objects. That's how DrRacket does it. If you could share a snippet of code or link to related library or docs, it could help to understand better the idea. I still relatively newbie in questions related to snyntax objects and overall scheme's expand. > > The attached DrRacket screenshot (of [1]), in which I've tacked a bunch=20 > of binding arrows, shows how local definitions and complex=20 > macro-introduced binding structures are supported. It also works across=20 > modules, even with renaming: in the program `#lang racket (define one=20 > 1)`, right-clicking on `define` and choosing "Jump to Binding=20 > Occurrence" will highlight `racket`, because the initial import of the=20 > racket language establishes the applicable binding of define, whereas=20 > choosing "Open Defining File" will open the racket/private/kw module,=20 > and then choosing "Jump to Definition (in Other File)" will jump to the=20 > definition of `new-define` on line 1171 of kw.rkt, which is renamed=20 > elsewhere to become the `define` of `#lang racket`. > > Since syntax objects from the expander encode all the details of scope,=20 > this works mostly automatically. DrRacket makes this functionality=20 > available as a library, so navigation features can also be used from=20 > Emacs with racket-xp-mode [2] or other editors with the Language Server=20 > Protocol [3]. > > That said, if you do want to associate extra information with values at > runtime, Guile has object properties [4], or of course you could always=20 > keep your own hash table on the side. Thank you for pointing to object properties! I guess we can implement our own eval, to attach location information to corresponding objects, I just expected it to be a part of the guile, because we already have this information for procedures anyway. The another problem with our own eval is that information for already loaded code won't be enriched with our custom stuff :/ > > Philip > > [1]:=20 > https://github.com/racket/racket/blob/6105332045595f8324985d7a34acc68fa5a= 61dcf/pkgs/racket-test/tests/json/indent.rkt#L244-L276 > [2]: https://www.racket-mode.com/#racket_002dxp_002dmode > [3]: https://github.com/jeapostrophe/racket-langserver/ > [4]:=20 > https://www.gnu.org/software/guile/manual/html_node/Object-Properties.html > x =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmZ+uJwACgkQIgjSCVjB 3rAmwQ//d5tcbfkBYGq48VVEYCqpOmhk8lbclis2t2FEdN4jhlL1amzvFdB8ggQp m8ek8kVfdC+Vxa5XkHx1F4MVF6+gGc7UOW8nHJnsDSgR6MNj4dkhxuBsok9m6EFj 2p/8hyEuO2OvvA9abEhSeURvfUPUrXTV2SeCcQdYAVr/yXlm3Yz8QMqF3N48LRjp NqIx704EMQxYiodjRedEo/DL8MdXeqluCLmy3J8XKIVVM7ipf5kP1AsnUUVzkkbJ mdIV+iMd+1u3mdWrqUbeuqr2WURSdPV1O5rxPC8PT9pN8K8h1tofJd88Ah8gqpEj fQtL+xA9ZjOSug20j1pYSdbUWd/632W47ZWe/ZgV9a18dBotZNGV9DIs4nFMLWZ9 KtK2De8Ksc9DNlhUFlgxb8cj/ECuTFktljq5JK4DtZMkP0UjJ+elEKDyGUAvetE4 AkdYAZqea5x2dm3L3VftJV9EaTol18CGCcpuX0IovtEwje8Nlq+Jx2ufUxlr1kSG R0Rci2RcEH89hyYIEqQ6qDei51zazNKadK8ZokVmD54U9rOnCysTpHsPEB8iMKQo iXXkjVn3WgnzdYPnXk6PN8dc8m/N+hbJ5QAR7nnGTIVdppmJmVOWrDF5UQLbYbHL hGsRLGMRi2lb4MYze2H1xpfsE0ShIKQlgdfBQM30ZFRBUzmTm4Q= =tjZo -----END PGP SIGNATURE----- --=-=-=--