[racket] Extending definitions window as part of #lang

From: Jonathan Schuster (schuster at ccs.neu.edu)
Date: Tue Jul 23 18:48:55 EDT 2013

I'm currently trying to write a #lang with a built-in analysis
visualization in DrRacket. The idea is that when I open a program written
in this #lang, a "Run Analysis" button should appear. When the button is
clicked, it should run the analysis and draw syntax-check-like arrows in
the definitions window to show the results of the analysis.

To do this, I'm using some code Ryan Culpepper wrote as part of the
macro-debugger collection that provides a mixin for drawing arrows. The
problem is that when I try to extend DrRacket using
drracket:get/extend:extend-definitions-text, I get the "cannot instantiate
`racket/gui/base' a second time in the same process" error. Here's a
trimmed down version of the code:

;; tool-lang-example/main.rkt:

#lang racket

(provide (all-from-out racket)
         get-info)

(require drracket/tool-lib)

(define (get-info info-kind default-value default-filter)
  (default-filter info-kind default-value))

(drracket:get/extend:extend-definitions-text (lambda (x) x))

;; tool-lang-example/lang/reader.rkt:

#lang s-exp syntax/module-reader tool-lang-example #:info get-info

(require tool-lang-example)

;; --

I also tried using lazy-require for drracket/tool-lib, but to no avail.

Is it possible to get this to work just as a #lang, without creating a
separate tool?

-Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130723/3ccebe1c/attachment.html>

Posted on the users mailing list.