From: "David Allsopp" <dra-news@metastack.com>
To: "'nicolas.pouillard'" <nicolas.pouillard@gmail.com>,
"'David.Teller'" <david.teller@mlstate.com>
Cc: "'Jacques Carette'" <carette@mcmaster.ca>,
"'caml-list'" <caml-list@inria.fr>,
"'Andrej Bauer'" <andrej.bauer@andrej.com>
Subject: RE: [Caml-list] Defining a family of functors
Date: Thu, 29 Jan 2009 10:40:50 -0000 [thread overview]
Message-ID: <00ed01c981fe$167d0c60$43772520$@com> (raw)
In-Reply-To: <1233221605-sup-9234@ausone.local>
> > 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
next prev parent reply other threads:[~2009-01-29 10:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-26 15:08 Michaël Grünewald
2009-01-26 15:15 ` [Caml-list] " Jacques Carette
2009-01-27 14:30 ` Andrej Bauer
2009-01-27 14:47 ` Jacques Carette
2009-01-27 21:12 ` David Teller
2009-01-28 0:32 ` Nicolas Pouillard
2009-01-28 11:25 ` David Teller
2009-01-29 9:37 ` nicolas.pouillard
2009-01-29 10:40 ` David Allsopp [this message]
2009-01-29 21:14 ` Mauricio Fernandez
2009-01-30 8:25 ` Michaël Grünewald
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='00ed01c981fe$167d0c60$43772520$@com' \
--to=dra-news@metastack.com \
--cc=andrej.bauer@andrej.com \
--cc=caml-list@inria.fr \
--cc=carette@mcmaster.ca \
--cc=david.teller@mlstate.com \
--cc=nicolas.pouillard@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox