Object ID's

Igor Bukanov igor at mir2.org
Tue Mar 27 01:39:09 PDT 2007


On 27/03/07, Lars T Hansen <lth at acm.org> wrote:
> On 3/27/07, Peter Hall <peter.hall at memorphic.com> wrote:
> > > tantalizing knowing they are probably there yet inaccessible.
> >
> > I think the important word here is "probably". The specification can't
> > mandate this sort of thing about it should be implementated.
>
> I've done (high-quality) run-time systems for Scheme and ECMAScript,
> and none of them have had anything like object IDs hidden in the
> implementation.  For non-moving collectors the problem is trivial, but
> for moving collectors it's a fair amount of work to implement object
> IDs in a way that's scalable and efficient.

Which again raises a question of the need to define hashCode in the
Object class. If the reason for its existence is to allow to write
hash tables (both weak and non weak), then what about just providing
Dictionary and WeakDictionary without intrinsic::hashCode?

With copy collectors the overhead of Dictionary and WeakDictionary
would be just in extra code to rehash the hash tables after GC. This
is better than to use extra memory in each and every object even if
that memory is just 2 bits for objects that are not hashed.

Regards, Igor



More information about the Es4-discuss mailing list