From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA18427 for caml-redistribution; Wed, 14 May 1997 17:56:08 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA17378 for ; Wed, 14 May 1997 16:58:59 +0200 (MET DST) Received: from arthur.u-strasbg.fr (boos@arthur.u-strasbg.fr [130.79.6.103]) by nez-perce.inria.fr (8.8.5/8.7.3) with ESMTP id QAA25107 for ; Wed, 14 May 1997 16:58:56 +0200 (MET DST) Received: (from boos@localhost) by arthur.u-strasbg.fr (8.7.5/8.7.3) id RAA02348; Wed, 14 May 1997 17:00:32 +0200 Date: Wed, 14 May 1997 17:00:32 +0200 Message-Id: <199705141500.RAA02348@arthur.u-strasbg.fr> From: Christian Boos MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: caml-list@inria.fr Subject: Dynamic module creation X-Mailer: VM 6.22 under 19.15 XEmacs Lucid Sender: weis [english version only, sorry !] Hello, I would advocate for dynamic creation of structures, either by building structs 'on the fly' or by dynamic functor application. These debate was started by A. Conway last year (see http://pauillac.inria.fr/caml/caml-list/0425.html), and was concluded by X. Leroy saying that it could be done, but that it was left out of the langage for the sake of simplicity. I face now the same kind of problem as Mr. Conway, that is, I have a functor that uses some values from its argument module which are constant in the scope of the generated module. For different values, I have to apply the functor on different modules. The problem arises when those value can't be computed at compile time. Dynamic module creation and functor application could solve this problem without the need of tricks. Actually, even using refs on values is not always sufficient when you simultaneously need differents sets of parameters. And when you come to give explicitly to your functions a record filled of parameters and functions ... then you're back to Caml-Light hand-made functors ! X. Leroy said that SML/NJ had this feature, but I couldn't find anything about that in my sml documentation (by the way, is there a REAL documentation for SML/NJ, the langage part, not its standard library ?). My suggestion would be to extend the syntax of expression: | expr: | ... | | LOCAL restricted-definition IN expr | | restricted-definition: | | module module-name {( module-name : module-type )} [: module-type] | = module-expr | | open module-path The semantic of this extension would be that the expression is evaluated in a locally-defined environment. I am aware that one technical difficulty is that this will involve mutual recursion between the module and the expression part of the langage, both in typing and code generation. In the current implementation, the module part is built upon the expr part. I think this extension would be really usefull & powerfull. Any comments ? -- Christian