Version française
Home     About     Download     Resources     Contact us    
Browse thread
Looking for a nail
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Michel Schinz <michel.schinz@c...>
Subject: Re: Looking for a nail
Miles Egan <> writes:

> 1. Extend OCaml's Unix library. What's already there is very useful,
> but there are quite a few functions missing. I'd be happy to help
> fill this out, although I'm new enough to OCaml and functional
> programming that I'm still not sure if some Unix functions were
> omitted because of their stateful semantics.

I think it would be nice if you took a look at scsh for that part.
Scsh is a Scheme interpreter with a complete Posix interface. The
design of scsh is really great IMHO and you could take many ideas from
it (mostly because Scheme is also a functional language, and the
design of scsh is also quite functional). However, porting the
complete scsh design to CAML is not trivial, since CAML (at least
Objective CAML) doesn't have a macro system, and Scheme's macros are
heavily used in scsh.

Anyway, the scsh page is at

> I'd appreciate any criticisms of these projects or any suggestions
> for others.

Here is a "big" suggestion: what I'd really like to see for OCaml is a
good and consistent data structure library. The one shipped with OCaml
is quite good, but there are some things I do not like about it:

- some parts are "imperative" (Array, Hashtbl, ...), while others are
  "functional" (Set, Map, ...),

- the interface of some of the modules are not as complete as one
  might wish (in almost all of my projects, I end up writing some
  basic functions, like list partitioning, ...),

- the interface of the different modules is not always consistent
  (e.g. in the Map module, the map is always given as the last
  parameter, while in the Hashtbl module, the table is given as the
  first argument, and that is confusing sometimes [and sometimes it
  also prevents the use of partial application]),

- none of the modules use the OO features of OCaml.

So, what I would really like to do (if only I had time) is:

1. take a good look at many good standard libraries of many languages,
   functional or not, object-oriented or not (e.g. Haskell, MIT
   Scheme, Common Lisp, C++'s STL, Eiffel, Okasaki's book, ...) and
   identify the most important data structures and the important
   operations that can be performed on them,

2. design two different versions of the library: one purely
   applicative, and the other one with in-place modification (note
   that these two versions could be different, because some data
   structures might not be efficient or interesting enough in the two
   versions; however, it would be great if the two designs were as
   similar as possible),

3. implement these two versions of the library,

4. document them thoroughly (e.g., give the complexity of every
   function, ...).

I'm still unclear about the OO features of OCaml, so I do not know
whether they should be used or not for these libraries.

Designing a good library is usually really hard, but I think that it's
a crucial point. C++ for example has almost become usable now that the
STL exists. And one of the main reasons why Common Lisp is usually
preferred to Scheme for big applications is that the former has a good
standard library (which is in fact part of the language itself) while
the latter has none (yet).