[plt-scheme] circular module dependency
As Matthew usually puts it, modules are units of compilation and units
are parameterized bodies of code. In a sense, the latter are functions,
but "bodies of code" refers to large collections of definitions and
parameterization can/could be over more than values as it would be in
the case of lambda.
I believe that the model-view architecture is one typical use of units
and mutual recursion between "bodies of code". Your program is just
that, so you should consider units or unit/sig-s instead of modules.
On Aug 11, 2004, at 8:21 AM, Ivanyi Peter wrote:
> (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)
> )
Small note: You might want to express this as (and (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
What you did is fine, if you want to stick with modules. But I agree
with Robby. Give units a try.
-- Matthias