[plt-scheme] circular module dependency

From: Robby Findler (robby at cs.uchicago.edu)
Date: Wed Aug 11 08:30:31 EDT 2004

You might try unit/sigs. The syntax is a bit complex, but if you really
don't want to re-arrange your code, that's probably the best option.

Robby

At Wed, 11 Aug 2004 14:21:20 +0200 (CEST), Ivanyi Peter wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> Hi,
> 
> There are two modules in my application which depend on each other.
> Both of them are quite large, I was thinking to make one module but
> they provide two different things. Basically they form a circular 
> dependency. I cannot separate out the parts into a third module.
> Guile and bigloo allowed me to do circular dependency, but 
> plt-scheme does not. (So far the strictness of plt-scheme helped me
> in the abstraction and dependency formulation, but now I am little
> bit stuck.) At the moment I provide a setup function in one of the 
> modules which must be called before any execution of the application.
> This setup function sets an internal variable to a function from the other
> module. I try to demonstrate it in pseude code:
> 
> (module selection mzscheme
>   (provide setup-selection ...)
> 
>   (define view-func #f)
> 
>   (define (setup-selection func)
>     (set! view-func func)
>   )
>   ...
>   ; somewhere we call the view function
>   (if (and view-func (procedure? view-func))
>     (view-func)
>   )
>   ...
> )
> 
> (module view mzscheme
>   (require selection ...)
>   (provide selection-view ...)
>   ...
>   ; body
> )
> 
> And in my main
>   (require selection view)
>   (setup-selection selection-view)
>   ; then start everything
> 
> 
> Somehow I feel it a little bit fragile. Maybe I am a perfectionist. But
> is there any better way to do this ? How can I make circular 
> dependency in plt-scheme ? (Maybe I do not see the forest from the 
> tree.)
> 
> Thanks for any advice.
> 
> Peter Ivanyi


Posted on the users mailing list.