From: Mauricio Fernandez <mfp@acm.org>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Defining a family of functors
Date: Thu, 29 Jan 2009 22:14:58 +0100 [thread overview]
Message-ID: <20090129211458.GK25469@NANA.localdomain> (raw)
In-Reply-To: <00ed01c981fe$167d0c60$43772520$@com>
On Thu, Jan 29, 2009 at 10:40:50AM -0000, David Allsopp wrote:
> > > 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)
See this page:
http://ocaml.janestreet.com/?q=node/29#comment-77
--
Mauricio Fernandez - http://eigenclass.org
next prev parent reply other threads:[~2009-01-29 21:15 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
2009-01-29 21:14 ` Mauricio Fernandez [this message]
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=20090129211458.GK25469@NANA.localdomain \
--to=mfp@acm.org \
--cc=caml-list@inria.fr \
/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