From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id TAA16078 for caml-redistribution; Mon, 8 Jan 1996 19:36:22 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id NAA08964 for ; Mon, 8 Jan 1996 13:08:44 +0100 Received: from victor.labri.u-bordeaux.fr (root@victor.labri.u-bordeaux.fr [147.210.8.168]) by concorde.inria.fr (8.7.1/8.7.1) with SMTP id NAA04680 for ; Mon, 8 Jan 1996 13:08:44 +0100 (MET) Received: from waves.labri.u-bordeaux.fr by victor.labri.u-bordeaux.fr (4.1/SM-mailhost-BORDEAUX-1.0) id AA24672; Mon, 8 Jan 96 13:09:26 +0100 Received: from [127.0.0.1] by waves.labri.u-bordeaux.fr (4.1/SM-BORDEAUX0.1) id AA14189; Mon, 8 Jan 96 13:07:26 +0100 Message-Id: <9601081207.AA14189@waves.labri.u-bordeaux.fr> From: Andrew Conway Reply-To: arc@labri.u-bordeaux.fr To: caml-list@pauillac.inria.fr Subject: modules local to functions. Date: Mon, 08 Jan 1996 13:07:25 +0100 Sender: weis Resume en tres pauvre Francais: je voudrais utiliser un "functor" au milleau d'une fonctionne, en utilisant les parametres de la fonctionne dans le "sig". Je ne peut pas le faire. Pourquoi pas? --------------------------------- I have a functor such as follows: module type Specifyn = sig val n : int end;; module Makespecific(N:Specifyn) = struct type mytype = int let mirror () : mytype = N.n end;; I can apply it at the main level like: module Fred = Makespecific(struct let n = 7 end);; However, there are cases when I want to define a module in the middle of a function (eg a functor of packed binary arrays where I want to determine the number of bits used at run time depending upon the arguement of the function). That is, I would like to be abe to do: let toto digits = module Fred = Makespecific(struct let n = digits end) in Fred.mirror ();; which seems to be reasonably within the spirit and syntax of csl. Even if that is not possible, something else like: let toto digits = let u = Makespecific(struct let n = digits end).mirror () in u ;; would also be useful although not an entirely satisfactory solution. Is this plausible? I seem to remember a discussion something along this line a while ago, but it may have been for sml. Thanks for making csl available, Andrew.