Browse thread
[Caml-list] Oo.id
-
james woodyatt
-
Jacques Garrigue
- james woodyatt
-
Lauri Alanko
- Jacques Garrigue
-
Jacques Garrigue
[
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: | Jacques Garrigue <garrigue@k...> |
| Subject: | Re: [Caml-list] Oo.id |
From: Lauri Alanko <la@iki.fi> > 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 beginners. Jacques Garrigue ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners