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 TAA25831 for caml-redistribution@pauillac.inria.fr; Fri, 10 Mar 2000 19:48:18 +0100 (MET) Resent-Message-Id: <200003101848.TAA25831@pauillac.inria.fr> 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 SAA18988 for ; Fri, 10 Mar 2000 18:56:14 +0100 (MET) Received: from mail2.microsoft.com (mail2.microsoft.com [131.107.3.124]) by nez-perce.inria.fr (8.8.7/8.8.7) with SMTP id SAA23690 for ; Fri, 10 Mar 2000 18:56:12 +0100 (MET) Received: from 157.54.9.104 by mail2.microsoft.com (InterScan E-Mail VirusWall NT); Fri, 10 Mar 2000 09:55:33 -0800 (Pacific Standard Time) Received: by INET-IMC-02 with Internet Mail Service (5.5.2651.58) id ; Fri, 10 Mar 2000 09:55:32 -0800 Message-ID: <783D93998201D311B0CF00805FEAA07B7E915E@RED-MSG-42> From: Manuel Fahndrich To: "'Markus Mottl'" Cc: caml-list@inria.fr Subject: RE: additions to standard library? Date: Fri, 10 Mar 2000 09:55:14 -0800 X-Mailer: Internet Mail Service (5.5.2651.58) Resent-From: weis@pauillac.inria.fr Resent-Date: Fri, 10 Mar 2000 19:48:18 +0100 Resent-To: caml-redistribution@pauillac.inria.fr The issue you are raising is a good one. SML/NJ can handle some of it, because the semantics of "open" are different there. Once can actually say: module Foo = struct open B end and obtain a copy of B within Foo. This might even work to extend functors as in: functor Foo(Arg : A) = struct module B = Bar(A) open B let extensions = ... end However, this interpretation of "open" has impacts on compilation dependencies, in particular scoping analysis (See e.g. "Dependency analysis for Standard ML; Matthias Blume; ACM Trans. Program. Lang. Syst. 21, 4 (Jul. 1999), Pages 790 - 812"). -Manuel -----Original Message----- From: Markus Mottl [mailto:mottl@miss.wu-wien.ac.at] Sent: Friday, March 10, 2000 12:04 AM To: caml-redistribution@pauillac.inria.fr Cc: caml-list@inria.fr Subject: Re: additions to standard library? > But when using functorial interfaces like Set.Make, you have to > redefine these functions for each application of the functor. Thus, > you really need these functions to be defined in the functor i.e. > together with the datatype (and, by the way, you can then define these > functions a bit more efficiently---without using exceptions). Exactly - this raises another question which has been bothering me from time to time when using the module system: How can you extend the functionality of a module without having to "copy" the definitions of the underlying module "by hand"? In a case which I found particularly ugly (in the "res"-library), I had to "copy" nearly 100 lines as in: module Foo = struct module B = ... type t = B.t ... let iter = B.iter let iteri = B.iteri let map = B.map let mapi = B.mapi ... end Everytime the other module gets extended, I have to add code by hand here, too, to make it available. I do not see any simple workaround for this. Extending standard libraries with needed functionality would be much easier if there were a convenient way to get around the problem above. Regards, Markus Mottl -- Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl