[plt-scheme] Incremental development with DrScheme or MzScheme

From: Chongkai Zhu (czhu at cs.utah.edu)
Date: Wed Oct 3 21:01:20 EDT 2007

Austin King wrote:
> Thanks for your help.
>
> I read
> Chapter 5 Modules from PLT MzScheme Language Manual and
> Chapter 55 unit.ss from PLT MzLib: LIbraries Manual
>
> I am still not able to do interactive development, where changes in
> one DrScheme window are picked up by a running MrEd window.
>
> After reading about modules, I tried this:
> ; new window Language "Pretty Big (includes MrEd and Adv Student)"
> ; in module-lib.scm
> (module module-lib
>   mzscheme
>   (define (foo)
>     "bar")
>   (provide foo))
> ; clicked run
>
> ; new window
> ; in module-test.scm
> (module module-test  mzscheme
>   (require "module-lib.scm")
>   (define (test-foo)
>     (display "Hello ")
>     (display (foo))(newline)
>     (sleep 1)
>     (test-foo))
>
>   (provide test-foo))
>
> (require module-test)
> (test-foo)
>
> ; click run
> ; The interaction window starts printing "Hello bar" over and over
>
> ; go back to module-lib window and change
>   (define (foo)
>     "bar")
> ;into
>   (define (foo)
>     "foo")
> ; click run
>  switch back to module-test.scm window and look at interaction window...
>  it is still printing "Hello bar"
>  I expected it to change to "Hello foo"
>
> Is this possible with DrScheme or MzScheme?
>
>   

In theory, by having two repl threads that share the same namespace, 
this is possible. But this is not a "good workflow for DrScheme", or 
anything close.

Chongkai

> On 10/3/07, Chongkai Zhu <czhu at cs.utah.edu> wrote:
>   
>> Please check the doc about ``module'' and ``unit''.
>>
>> Austin King wrote:
>>     
>>> Howdy,
>>> I would like to start a long running process and then redefine parts
>>> of the Scheme code, recompile, and have the long running process pick
>>> up these changes.
>>>
>>> My understanding is that DrScheme Run button cleans out the
>>> environment for the "Definitions" and "Interactions" windows. Is this
>>> correct? Clicking 'Run', I see it kill my running GUI and start a
>>> fresh copy.
>>>       
Yes. People use the REPL (i.e., the Interaction windows) to have similar 
effects. So, please don't hit the 'Run' if you don't want to kill your 
running program. Maybe all you need is just multiple threads? In another 
word, you have your running GUI in one thread, and in the main thread, 
you use the REPL to type in new definitions (or change old definitions). 
And your running GUI should see new definitions immediately.
>>> Should I use (load "foo.scm") from the interactions window to reload
>>> changed code? For partial load/compilation just copy and past s-exp
>>> that I want to re execute?
>>>
>>> I am looking for something like SLIME+sbcl where I can compile an
>>> s-exp and this immediately shows up in the running environment. If
>>> this isn't possible, then a pointer to good workflow for DrScheme.
>>> Thanks.
>>>
>>> Congratulations on an excellent project.
>>>
>>>
>>>       
>>     
>
>
>   



Posted on the users mailing list.