guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] Eval sets incorrect runtime metainformation


From: Philip McGrath
Subject: Re: [BUG] Eval sets incorrect runtime metainformation
Date: Sat, 29 Jun 2024 15:55:30 -0400
User-agent: Mozilla Thunderbird

On 6/28/24 09:20, Andrew Tropin wrote:
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-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:

--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---

How hard is to make a generic metainformation, which is attachable to
macros, symbols and other objects of the language, not only to
procedures?


Instead of run-time reflection on values, I think an IDE implementing
jump to definition should use source location and binding information
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'm not intimately familiar with the implementation, but a key library is drracket/check-syntax, documented at [1], which is implemented in the [2] Git repository (mostly in the drracket-tool-text-lib directory, but with tests etc. elsewhere). The source for the Emacs usage is at [3]. You can probably get more useful advice on <https://racket.discourse.group>, especially from Robby Findler and Greg Hendershot. (Note that, while it requires one-time registration, Racket's Discourse instance is configured to be usable as a mailing list, including starting new threads by email.)

[1]: https://docs.racket-lang.org/drracket-tools/Accessing_Check_Syntax_Programmatically.html
[2]: https://github.com/racket/drracket
[3]: https://github.com/greghendershott/racket-mode/

I still relatively newbie
in questions related to snyntax objects and overall scheme's expand.


The Scheme reports leave it to implementations to decide how to implement syntax objects and expansion more generally, so you will need some Guile-specific code. The procedures documented in [4] seem like a good place to start, especially `syntax-source`, `syntax-module`, and `syntax-local-binding`. I expect Guile has all of the functionality you would need, though some of it might be internal or awkward to use. It is possible, though, that you might need or want to enhance the expander: Racket's expander is especially feature-rich in this area, in part because Racket (MzScheme) was originally created to write DrRacket (DrScheme), so this kind of tool support has been a consideration from the beginning.

[4]: https://www.gnu.org/software/guile/manual/html_node/Syntax-Transformer-Helpers.html

Philip



reply via email to

[Prev in Thread] Current Thread [Next in Thread]