[racket-dev] Shared-instantiation modules

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Fri Sep 10 19:08:56 EDT 2010

On Fri, Sep 10, 2010 at 5:39 PM, Ryan Culpepper <ryanc at ccs.neu.edu> wrote:
> On 09/10/2010 04:04 PM, John Clements wrote:
>>
>> On Sep 10, 2010, at 1:48 PM, Ryan Culpepper wrote:
>>
>>> The way the rackunit tool does it (to make the rackunit gui
>>> DrRacket-aware) is to attach a module into the user namespace on every
>>> execution by overriding the 'reset-console' method of drracket:rep:text%.
>>> See rackunit/tool.rkt for the code.
>>>
>>> Then you can have a module/teachpack that just requires the attached
>>> module.
>>
>> Good Gravy!  It would have taken me *weeks* to figure that out. Especially
>> the bit about making the shared link module written in the #%kernel
>> language. Yikes!
>
> I think it did take weeks, plus a few conversations with Robby, to get that
> bit of code right. (Although part of that was about threads and
> eventspaces.)
>
> Using the #%kernel language for the shared moduel is probably overkill,
> since IIUC DrRacket already attaches other modules to make classes and guis
> work.
>
> Robby: What modules currently get attached by DrRacket?

      (list 'mzscheme
            '(lib "mzlib/foreign.rkt")
            '(lib "mred/mred.rkt")
            '(lib "mrlib/cache-image-snip.rkt")
            '(lib "mrlib/image-core.rkt")
            '(lib "mrlib/matrix-snip.rkt")
            '(lib "mzlib/pconvert-prop.rkt")
            '(lib "planet/terse-info.rkt"))

and possibly more that tools attach.

But keeping this list fairly small is important. For example, the
matrix-snip.rkt file used to be written in "#lang racket" which caused
problems.

Robby


Posted on the dev mailing list.