caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "David Allsopp" <dra-news@metastack.com>
To: "'Dario Teixeira'" <darioteixeira@yahoo.com>,
	<caml-list@yquem.inria.fr>,
	"'David Allsopp'" <dra-news@metastack.com>
Subject: RE: [Caml-list] Lazy modules
Date: Thu, 18 Mar 2010 11:10:14 -0000	[thread overview]
Message-ID: <010d01cac68b$95fcffe0$c1f6ffa0$@romulus.metastack.com> (raw)
In-Reply-To: <864095.98227.qm@web111502.mail.gq1.yahoo.com>

Dario Teixeira wrote:
> Hi,
> 
> > AFAIK local modules is a syntax extension not a compiler extension - I
> > expect (not looked at it) that the syntax extension simply alpha
> > renames all the local module declarations to make them unique and puts
> > them globally... a very useful extension but no expressive power
> > added.
> 
> But if that were true, wouldn't the functor instantiation happen at
> initialisation time, thus preventing the delayed instantiation that is
> key for this solution to work?

Yup, somewhat embarrassingly I seemed to be barking in the wrong forest there, let alone up the wrong tree!!

> > I believe that the module system due for OCaml 3.12.0 will allow this
> > kind of runtime application of functors as modules are first class
> > values.
> 
> Again, I'm under the impression that functor application can already
> (with 3.11 at least) occur at runtime when local modules are used.
> (Or are you talking about different things?).  For example:
> 
> # module Foo (S: sig end) = struct let () = print_endline "foo!" end;;
> module Foo : functor (S : sig  end) -> sig  end
> 
> # let hello () = let module F = Foo (struct end) in ();; val hello :
> unit -> unit = <fun>
> 
> # hello ();;
> foo!
> - : unit = ()
> 
> 
> > Hope that's helpful - the inability to do what you're wanting to do is
> > one of the reasons that I've never delved deeply into the module
> > system - powerful as it may be, it didn't seem to be able to help
> > performing a simple task (similar to yours) that I wanted it to do (I
> > have also in the past wanted to exactly what you're doing - i.e. a
> > module of loaded configuration values).
> 
> Yep, Alain confirmed that modules as first-class values are indeed
> coming for 3.12.  Ocaml's module system just got more interesting...

Definitely!


David


  reply	other threads:[~2010-03-18 11:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-17 17:04 Dario Teixeira
2010-03-17 17:36 ` [Caml-list] " Alain Frisch
2010-03-17 18:18   ` Dario Teixeira
2010-03-17 17:42 ` David Allsopp
2010-03-17 18:23   ` Alain Frisch
2010-03-18 11:10     ` David Allsopp
2010-03-22 18:08     ` Yoann Padioleau
2010-03-17 18:37   ` Dario Teixeira
2010-03-18 11:10     ` David Allsopp [this message]
2010-03-18 14:22       ` Goswin von Brederlow

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='010d01cac68b$95fcffe0$c1f6ffa0$@romulus.metastack.com' \
    --to=dra-news@metastack.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=darioteixeira@yahoo.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;
as well as URLs for NNTP newsgroup(s).