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
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-10-10 (00:53)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list]
From: Lauri Alanko <>
> On Fri, Oct 04, 2002 at 04:58:24PM +0900, Jacques Garrigue wrote:
> > Using the address would be ok for equality, but not for compare, as
> > the GC may move things around: the result of compare might change.
> Why does there need to be an ordering for objects in the first place?
> This seems about as sensible as ordering closures (ie. not very).

Because objects have identity and data contents, which closure don't
have. You need the ordering for functors like Map or Set, and it has
to be an int for Hashtbl.

> Alternatively, if the stability of addresses is important, couldn't
> objects be allocated in a special heap where GC would be non-copying?

You might want stability of addresses for all mutable data structures,
but this would also mean a much less eficient GC. As Caml is a
functional language, GC speed is favored over a strong definition of
physical ordering. You just have to add an id when you need it, which
is not really difficult. Strictly speaking, the id could be delegated
to users for objects too, but having it buitin avoids trouble with

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