[racket-dev] Shared-instantiation modules

From: Ryan Culpepper (ryanc at ccs.neu.edu)
Date: Fri Sep 10 16:48:00 EDT 2010

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.

Ryan


On 09/10/2010 01:21 PM, John Clements wrote:
> Seems like a FAQ, but:
>
> I want to associate a single "sound player" with a drscheme process.  When student code runs, it needs to send messages to that sound player.  I want to make sure there's only one running at a time.
>
> The first thing that pops into my head is some kind of "shared-require" form, but I don't see such a thing.
>
> The second thing that pops into my head is a tool; I understand how I can set up a tool so that it gets run only once at startup, and creates a value that gets associated with every DrRacket frame.  Unfortunately, I can't figure out the second part of the equation: how does a user program then connect to the DrRacket frame to get the value? I don't want to make the user click some extra button every time they run their program, and I *really* don't want to mess around with language levels and manipulating the user's source code.
>
> Basically, I just want a process-level global value.  I must be missing something really obvious, here.
>
> Thanks,
>
> John
>
>
>
>
>
>
> _________________________________________________
>    For list-related administrative tasks:
>    http://lists.racket-lang.org/listinfo/dev


Posted on the dev mailing list.