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 KAA13027 for caml-redistribution@pauillac.inria.fr; Mon, 13 Mar 2000 10:25:18 +0100 (MET) Resent-Message-Id: <200003130925.KAA13027@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 TAA10616 for ; Sat, 11 Mar 2000 19:53:14 +0100 (MET) Received: from shell5.ba.best.com (shell5.ba.best.com [206.184.139.136]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id TAA21416; Sat, 11 Mar 2000 19:53:12 +0100 (MET) Received: from localhost (bpr@localhost) by shell5.ba.best.com (8.9.3/8.9.2/best.sh) with ESMTP id KAA19792; Sat, 11 Mar 2000 10:49:07 -0800 (PST) Date: Sat, 11 Mar 2000 10:49:07 -0800 (PST) From: Brian Rogoff To: Francisco Valverde Albacete cc: ohl@hep.tu-darmstadt.de, caml-list@inria.fr, Markus Mottl , Pierre.Weis@inria.fr Subject: Re: additions to standard library? In-Reply-To: <38C8C895.A0B778FC@tsc.uc3m.es> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Resent-From: weis@pauillac.inria.fr Resent-Date: Mon, 13 Mar 2000 10:25:18 +0100 Resent-To: caml-redistribution@pauillac.inria.fr On Fri, 10 Mar 2000, Francisco Valverde Albacete wrote: > Thorsten Ohl wrote: > > > Markus Mottl writes: > > > > > Hello, it sometimes happens that I need functions on abstract data > > ^^^^^^^^^ often :-) > > > types in the standard library which are not available there, but > > > could be considered as "usual" operations on such data. > > > > > Some specific examples include, e.g.: > > > > My favorites are Map and List, of which I keep carrying around > > turbocharged versions. > > Yes... I've done the coding of functional iterators on some dozen ADT > (written as functors or modules) by now. At first I pretended that they would > not be necessary but in the end I found I had to code them all, (with all the > fuss added of making them visible in the signatures of the implementations, > etc). >>From what I understand, this is what classes and objects are for, though of course in OCaml there aren't yet polymorphic methods so you lose a lot in trying to write extensible ADTs in OCaml this way. If we had polymorphic methods would that tip the balance in favor of classes for a utility library? > ... snip ... > > PRO: The good thing as X. Leroy stated some time ago is that we do not incur > in any penalty for such definitions. I bet a lot of the penalty of OO style could be eliminated if you have a compiler that does lots of global analysis, like the SmallEiffel compiler. > My proposal for now (not the most elegant, I know) would be to add a > syntactic feature in the language similar to "include" for signatures, but > effecting textual inclusion of module code, as T.Ohl suggests. Some time ago > I thought this could be managed by using Camlp4, the caml preprocessor, but > then the implementor suggested it was hardly used except for Coq and I was > loath to tackle with it. That's too bad, I think that some kind of macro approach might be useful for this problem. -- Brian