Browse thread
Defining a family of functors
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | David Allsopp <dra-news@m...> |
| Subject: | RE: [Caml-list] Defining a family of functors |
> > On the other hand, it was pointed to me that Alain already wrote a > > compiler patch implementing first-class modules. > > That's right. I have two questions - the first of which will probably demonstrate my lack of skill with the OCaml module system. 1. Does first-class modules, as with first-class functions mean that you can pass them around in code? For example, I have a web-app where all of the stuff which has to access databases is put into a single module with a known signature DB. I then have two modules MSSQLDriver and PGSQLDriver which implement the database functions for two different back-ends and have in DB.ml module DB = MSSQLDriver include DB So when I build for Postgres, I just change the module statement and recompile. Would first class modules allow me to read the back-end configuration from a config file and write something like: module DB = if Config.driver = `MSSQL then MSSQLDriver else PGSQLDriver Or is it about something totally different? :o) 2. Is this patch intended for a future version of OCaml or just for research purposes? David