| View previous topic :: View next topic |
| Author |
Message |
Knocker professional

Joined: 05 Nov 2002 Posts: 612 Location: Germany
|
Posted: Tue Jan 04, 2005 9:27 am Post subject: OCaml question regarding circular dependencies |
|
|
Hi,
does anybody know if it's true that I cannot refer from one module to another and vice versa?
I played with the code of 2.5.16 especially files donkeyServers.ml and donkeyUdp.ml. There are function calls from inside donkeyServers.ml to donkeyUdp.ml. Now I wanted to call a function which lies in donkeyServers.ml from donkeyUdp.ml, but I always get "unbound value" error.
I read somewhere that Ocaml doesn't support forward-declarations. If that's true, do I have to move the code with the function call from donkeyUdp.ml to donkeyServers.ml? |
|
| Back to top |
|
 |
pango Sage

Joined: 31 Oct 2002 Posts: 2436
|
Posted: Tue Jan 04, 2005 10:53 am Post subject: |
|
|
See http://caml.inria.fr/ocaml/htmlman/manual022.html,
starting from "Reference to undefined global mod"
There's no single "best answer" to that question. I recommend thinking at the "program architecture and layering" level, cross-references often (but not always) mean you're breaking some layering.
Or that the layering is badly defined to start with  |
|
| Back to top |
|
 |
Knocker professional

Joined: 05 Nov 2002 Posts: 612 Location: Germany
|
Posted: Tue Jan 04, 2005 11:55 am Post subject: |
|
|
Thanks
> Or that the layering is badly defined to start with
donkeyServers.ml needs DonkeyUdp.search_handler to search files, but I want to use server_waiting_queries (defined in donkeyServers.ml) from donkeyUdp.ml where source-searching per UDP is defined.
I moved the search-code to donkeyServers.ml but wanted to know if I could've done something better. |
|
| Back to top |
|
 |
pango Sage

Joined: 31 Oct 2002 Posts: 2436
|
Posted: Tue Jan 04, 2005 4:44 pm Post subject: |
|
|
| Isn't server_waiting_queries defined in donkeyTypes.ml ? |
|
| Back to top |
|
 |
|