From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 22B91BCB4 for ; Thu, 18 Mar 2010 12:10:56 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtgAADmnoUtRZ90hmWdsb2JhbACDC5giFQEBAQEBCAsKBxMip0CQSYEsgmRpBA X-IronPort-AV: E=Sophos;i="4.51,265,1267398000"; d="scan'208";a="47075831" Received: from queueout03-winn.ispmail.ntl.com ([81.103.221.33]) by mail3-smtp-sop.national.inria.fr with ESMTP; 18 Mar 2010 12:10:55 +0100 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20100318111018.FCFL10950.mtaout03-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com>; Thu, 18 Mar 2010 11:10:18 +0000 Received: from romulus.metastack.com ([81.102.132.77]) by aamtaout02-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20100318111018.HELO21638.aamtaout02-winn.ispmail.ntl.com@romulus.metastack.com>; Thu, 18 Mar 2010 11:10:18 +0000 Received: from Tenor ([212.183.140.51]) (authenticated bits=0) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id o2IBA7nK002423 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Thu, 18 Mar 2010 11:10:14 GMT From: "David Allsopp" To: "'Dario Teixeira'" , , "'David Allsopp'" References: <00d801cac5f9$474281f0$d5c785d0$@romulus.metastack.com> <864095.98227.qm@web111502.mail.gq1.yahoo.com> In-Reply-To: <864095.98227.qm@web111502.mail.gq1.yahoo.com> Subject: RE: [Caml-list] Lazy modules Date: Thu, 18 Mar 2010 11:10:14 -0000 Message-ID: <010d01cac68b$95fcffe0$c1f6ffa0$@romulus.metastack.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQLUbXjWSuE2lGv95m/jP0nVYpbTzQFxoLEUAeO2r0c= Content-Language: en-gb X-MSL-Actually-To: dra-news@metastack.com Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 81.102.132.77 X-Cloudmark-Analysis: v=1.1 cv=W3tOLUehizD4qj6VhtReFuw5MKb8d+XqjIxlDsIazEA= c=1 sm=0 a=8sW17jYxVu0A:10 a=IkcTkHD0fZMA:10 a=W0ZiQAKDNnWs3wWSLcoA:9 a=3iO65AuChFdjgNDR9VETKCnbxMIA:4 a=QEXdDO2ut3YA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 X-Spam: no; 0.00; afaik:01 syntax:01 compiler:01 syntax:01 renames:01 functor:01 yup:01 ocaml:01 runtime:01 functors:01 functor:01 runtime:01 foo:01 sig:01 struct:01 Dario Teixeira wrote: > Hi, >=20 > > 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. >=20 > 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. >=20 > 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: >=20 > # module Foo (S: sig end) =3D struct let () =3D print_endline "foo!" = end;; > module Foo : functor (S : sig end) -> sig end >=20 > # let hello () =3D let module F =3D Foo (struct end) in ();; val hello = : > unit -> unit =3D >=20 > # hello ();; > foo! > - : unit =3D () >=20 >=20 > > 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). >=20 > 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