[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Very general OCaml questions

Dear miragers,

I have two OCaml questions. One is more philosophical, and the second more 

1) ----------------------
I want to define a signpost tactic as a package of functionality with a well 
defined and known signature.
Modules would be perfect, if it wasn't for the fact that I want to be able to 
pass around all the signpost tactics as a list, and since modules aren't first 
class data, like functions, I cannot do something like

let tactics = [iodine; OpenVPN; Tor; etc]

and then later call the functions defined in the modules...

I could define the tactics as classes since I could then easily pass them 
around, but I feel somewhat dirty using classes in a nice functional language.

An option could be to combine modules and records, where the standard set of 
functions are exposed in the record, and from there invoke the module 
functions, but that doesn't seem very natural or clean either.

What is the preferred approach?

2) ----------------------
If I want to define a set of high level types that should be shared between all 
my modules and functions, how do I go about doing that?
I tend to end up creating monolithic monsters of OCaml programs with everything 
defined in one file, just to avoid redefining the same types in all my files, 
and that clearly is the wrong approach :)

---------------------- (the end)


~ Sebastian



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.