Browse thread
additions to standard library?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Brian Rogoff <bpr@b...> |
| Subject: | Re: additions to standard library? |
On Fri, 10 Mar 2000, Francisco Valverde Albacete wrote: > Thorsten Ohl wrote: > > > Markus Mottl <mottl@miss.wu-wien.ac.at> 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