omg thank you so much!!<div>that's just what I want it!</div><div><br><div class="gmail_quote">2010/11/13 Thomas Chust <span dir="ltr"><<a href="mailto:chust@web.de">chust@web.de</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
2010/11/13 김태윤 <<a href="mailto:kty1104@gmail.com">kty1104@gmail.com</a>>:<br>
> [...]<br>
<div class="im">> I was told by mailing list that read the racket guide unit section<br>
> but sorry I still don't understand.<br>
</div>> [...]<br>
<br>
Hello,<br>
<br>
you have to use units here because modules do not allow mutually recursive<br>
dependencies. An example for your situation may look like this:<br>
<br>
-----BEGIN "ab-sig.rkt"-----<br>
#lang racket<br>
<br>
(define-signature a^<br>
(a))<br>
<br>
(define-signature b^<br>
(b))<br>
<br>
(provide<br>
(all-defined-out))<br>
-----END "ab-sig.rkt"-----<br>
<br>
-----BEGIN "a.rkt"-----<br>
#lang racket<br>
(require<br>
"ab-sig.rkt")<br>
<br>
(define-unit a@<br>
(import b^)<br>
(export a^)<br>
(define a 1)<br>
(printf "a@ sees b = ~s~%" b))<br>
<br>
(provide<br>
(all-defined-out))<br>
-----END "a.rkt"-----<br>
<br>
-----BEGIN "b.rkt"-----<br>
#lang racket<br>
(require<br>
"ab-sig.rkt")<br>
<br>
(define-unit b@<br>
(import a^)<br>
(export b^)<br>
(define b 2)<br>
(printf "b@ sees a = ~s~%" a))<br>
<br>
(provide<br>
(all-defined-out))<br>
-----END "b.rkt"-----<br>
<br>
-----BEGIN "ab.rkt"-----<br>
#lang racket<br>
(require<br>
"ab-sig.rkt" "a.rkt" "b.rkt")<br>
<br>
(define-values/invoke-unit/infer<br>
(export a^ b^)<br>
(link a@ b@))<br>
<br>
(printf "ab.rkt sees a = ~s~%" a)<br>
(printf "ab.rkt sees b = ~s~%" b)<br>
-----END "ab.rkt"-----<br>
<br>
As you can see, the module dependencies are cycle free but the unit dependency<br>
between a@ and b@ is mutual.<br>
<br>
Note that, even though a@ and b@ can see each other's variables exported through<br>
the signatures a^ and b^ respectively, the units still have to be initialized<br>
in some order and hence one of the printf calls in a@ or b@ will show an<br>
undefined value when "ab.rkt" is run.<br>
<br>
I hope this helps :-)<br>
<br>
Ciao,<br>
Thomas<br>
<font color="#888888"><br>
<br>
--<br>
When C++ is your hammer, every problem looks like your thumb.<br>
</font></blockquote></div><br></div>