[racket] How to communicate from macro to DrRacket tool ?

From: Nick Main (david.nick.main at gmail.com)
Date: Wed Apr 3 22:28:53 EDT 2013

Thanks - I got a simple example of drracket:module-language-
tools:add-online-expansion-handler to work.

It looks really useful, however it appears to be called after normal macro
expansion has occurred. This makes it hard to recognize the "state-machine"
forms that I want to handle, since they have already been expanded away.


On Wed, Apr 3, 2013 at 5:53 PM, Robby Findler
<robby at eecs.northwestern.edu>wrote:

> You want to hook into the online expansion, right? You can register a
> handler that's called after online expansion completes in the place where
> it runs and then its results are passed back to a handler you register on
> the other side, back in DrRacket's main place. This is how online check
> syntax works.
> http://docs.racket-lang.org/tools/drracket_module-language-tools.html?q=drracket%20online#%28def._%28%28lib._drracket%2Ftool-lib..rkt%29._drracket~3amodule-language-tools~3aadd-online-expansion-handler%29%29
> This goes only one direction, tho, from the code to your view. Making the
> view manipulations change the source text would have to be some more
> mundane type thing where you just override various GUI callbacks and then
> work at the character/string level with the text% object in the definitions
> window.
> hth,
> Robby
> On Wed, Apr 3, 2013 at 7:21 PM, Nick Main <david.nick.main at gmail.com>wrote:
>> I am developing a DrRacket plugin that adds a diagrammatic view to the
>> IDE (roughly the same place as the Module Browser).
>> The diagram is a visualization of certain forms in the current text
>> editor. Ultimately I would like to make the connection be bi-directional -
>> manipulating the diagram will change values in the text editor.
>> The initial use-case is a state-machine visualizer (and later, editor).
>> My current approach uses a macro to define the state-machine. I would
>> like to drive the generation of the diagram from the uses of the macro
>> (during background expansion), rather than writing my own code to detect
>> text changes and parse the contents of the editor.
>> I am trying to find an easy way to communicate from the macro execution
>> to the DrRacket plugin, but nothing has surfaced so far.
>> If all else fails I could open up a socket connection in the macro and
>> talk to the plugin that way (I assume).
>> Are there any cheaper ways to poke a hole through the macro sandbox ?
>> --Nick
>> ____________________
>>   Racket Users list:
>>   http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130403/5e9613e9/attachment-0001.html>

Posted on the users mailing list.