Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Should be INSIDE STANDARD-LIB: Hashtbl.keys
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-24 (01:59)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Should be INSIDE STANDARD-LIB: Hashtbl.keys
On Sat, 2004-04-24 at 01:03, Richard Jones wrote:
> Maybe there's no good behaviour, but I keep writing a 'keys' function
> in almost every program I've written which uses Hashtbl, which
> certainly suggests that something is missing.

The problem is that the Ocaml hashtbl isn't a conventional
hash table. It allows multiple bindings which means it
cannot be treated as a simple container.

I spend some time making sure I don't use that
feature by mistake. 

Similar 'too rich' functionality exists for
many data types, for example mutable strings and arrays.
On the other hand some functionality is missing,
for example variable length arrays.

The former can be fixed easily by the client
building a wrapper library with restricted functionality.

The latter *needs* to be added to the standard
library urgently because it cannot be implemented
at all in Ocaml without magic, and it is a very
useful and important data structure to have.

John Skaller,
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: